variables:nowposition(0),signDTStr("");
DefineDLLFunc: "C:\Program Files (x86)\OrderMaster\OMSignAPI.dll",bool,"IniDllAndPosition",LPSTR,int;
DefineDLLFunc: "C:\Program Files (x86)\OrderMaster\OMSignAPI.dll",bool,"GoOrder",LPSTR,LPSTR,LPSTR,int,double;
if date<>date[1] then begin
IniDllAndPosition("TTO", 0);
end;
買進策略......
nowposition = 1;
end;
賣出策略......
nowposition = -1;
end;
if marketposition<0 then begin
buytocover("stop1") next bar at entryprice+70 stop;
end;
if marketposition>0 then begin
sell("stop2") next bar at entryprice-70 stop;
end;
======================================================================
以上那兩段是停損,問題來了 MC在MC上面有停損,但是MC接下單大師沒有執行停損還停留在那一口單,請問內容哪邊錯誤了呢,麻煩高手指導一下 感謝 .....(萬用API範例)
平倉.....
nowposition = 0;
end;
value100=MarketPosition;
if value100<>value100[1] then begin
text_Content = NumToStr( iff( value100=0, ExitPrice(0), EntryPrice(0) ),0 );
text_onChart = text_New(Date , Time, iff(value100>value100[1], L, H) Points,"");
TeXT_SetString(TeXT_onChart,iffstring(value100>value100[1],"|n"+TeXT_Content,TeXT_Content+"|n"+"|n"+"|n"+"|n"+"|n"+"|n"));
text_SetStyle(text_onChart, 4, 4);
text_SetColor(text_onChart, white);
text_setsize(text_onChart, 14);
end;
{api}
if nowposition = 1 then begin
signDTStr = numtostr(year(date)+1900,0) +"/" + numtostr(month(date),0) + "/" + numtostr(dayofmonth(date),0) + " " + numtostr(time,0) + "00";
GoOrder("TTO", "", signDTStr , nowposition, Close);
end;
if nowposition = 0 then begin
signDTStr = numtostr(year(date)+1900,0) +"/" + numtostr(month(date),0) + "/" + numtostr(dayofmonth(date),0) + " " + numtostr(time,0) + "00";
GoOrder("TTO", "", signDTStr , nowposition, Close);
end;
if nowposition = -1 then begin
signDTStr = numtostr(year(date)+1900,0) +"/" + numtostr(month(date),0) + "/" + numtostr(dayofmonth(date),0) + " " + numtostr(time,0) + "00";
GoOrder("TTO", "", signDTStr , nowposition, Close);
end;
|