各位先進與小幫手好 最近碰到一個問題希望能幫忙解決
就是在寫觸價進場的時候,以5分K為例;在5分K棒內觸價進場且同時觸價出場,系統會判斷已達到觸價進場點而又再次進場。
想請問各位先進與小幫手可有解決的方法 感謝回復
各位先進與小幫手好 最近碰到一個問題希望能幫忙解決
就是在寫觸價進場的時候,以5分K為例;在5分K棒內觸價進場且同時觸價出場,系統會判斷已達到觸價進場點而又再次進場。
想請問各位先進與小幫手可有解決的方法 感謝回復
這種情況通常都是腳本問題,要看你的腳本是如何判斷進出場。
M大您好 以下是我的腳本
判斷進出場的部分就只有觸價 但停利賣出後 不管是同一根K棒 或者隔了好幾根 還是會持續買進補到三張
不知哪裡出了問題 請M大指教 感謝
input: profit_percent(1, "停利(%)");
input: price(20, "進場價格");
input:length(10,"5分鐘K線");
input:profit_percent1(1, "停損(%))");
value1 = highestBar(volume, length);
condition1 = close>=price ;
if position = 0 and condition1 then setposition(3);
if Position = 3 and Filled = 3 then begin
{ 依照成本價格設定停損/停利 }
if profit_percent > 0 and Close >= FilledAvgPrice*(1+0.01*profit_percent) then begin
{ 停利 }
SetPosition(0);
試試看以下腳本吧
input: profit_percent(1, "停利(%)");
input: price(20, "進場價格");
input:length(10,"5分鐘K線");
input:profit_percent1(1, "停損(%))");
value1 = highestBar(volume, length);
condition1 = close cross over price ; //改穿越價才進場,避免停利後又進場
{進場-多單}
if (position = 0 and Filled = 0) //確定沒有委託單和空倉才判斷進場
and condition1
then setposition(3);
{出場-多單}
if (position = 3 and Filled = 3)
then begin
{停利}
if profit_percent > 0
and Close >= FilledAvgPrice*(1+0.01*profit_percent)
then SetPosition(0)
else
{停損}
if profit_percent1 > 0
and Close <= FilledAvgPrice*(1-0.01*profit_percent1)
then SetPosition(0);
end;
好的 感謝M大 我來試試看
Hello 三發弟弟,
主要是因為您的條件 condition1 = close>=price ; 只要價格大於等於設定的 price 就會觸發,很容易就達成。
您可以參考 musashi 的作法,將條件便困難,或是用變數記錄當下時間或日期來限定多久才能交易一次,或是一天一次。
5 評論