1. output your values to a temporary debug file so you can see what is going on (PTS set to 0.03 doesn't seem valid for ES).
2. track if a trade has been entered today by watching MarketPosition.
3. Exit near the end of the day
4. Buy my trading software that autogenerates EasyLanguage (when I release it someday).
Input: TimeCalc (1000), Length(9), PTS(5);
Var:
bool HaveTradedToday(false);
if CurrentBar = 1 then
FileDelete( "c:\debug.txt" );
If Time = Timecalc then begin
Value1 = Highest(high,length);
Value2 = Lowest(Low,Length);
HaveTradedToday = false;
End;
If Time > Timecalc and HaveTradedToday = false then begin
FileAppend( "c:\debug.txt", NumToStr(PTS,2) + "," + NumToStr(Value1,2) + "," + NumToStr(Value2,2) + "," + NumToStr( Value1+PTS, 2 ) + "," + NumToStr(Value2-PTS, 2 ) + NewLine );
Buy("le") next bar at Value1 + PTS points stop;
SellShort("se") next bar at Value2 - PTS points stop;
End;
if MarketPosition <> 0 then
HaveTradedToday = true;
if ( Time > 1230 ) then begin
Sell("lx-eod") next bar at market;
BuyToCover("sx-eod") next bar at market;
end;