I can't make it work no matter what, because it uses OLD data in the past without any reason (data that do not even exist.....).
Simple code here with print to output as debug....
protected override void OnBarUpdate() { PrintWithTimeStamp("Bar Update: "+ Close[0]+ "; Bar Time " + ToTime(Time[0])); if (Position.MarketPosition == MarketPosition.Flat) { Print("Flat"); if (Close[0] >= StopLong) { Print("Enter long"); } if (Close[0] <= StopShort) { Print("Enter Short"); }}}
The problem is with Close[0].
In the output window i should have only the line:
11/04/2008 13.46.40 Bar Update: 1246,25; Bar Time 134640 Flat
27/03/2008 1.05.10 Bar Update: 1336; Bar Time 10510 Flat Enter long 27/03/2008 1.05.20 Bar Update: 1336,25; Bar Time 10520 Flat Enter long 27/03/2008 1.05.40 Bar Update: 1336; Bar Time 10540 Flat Enter long 27/03/2008 1.05.50 Bar Update: 1336; Bar Time 10550 Flat Enter long 27/03/2008 1.06.00 Bar Update: 1335,75; Bar Time 10600 Flat Enter long 27/03/2008 1.06.20 Bar Update: 1336; Bar Time 10620 Flat Enter long 27/03/2008 1.06.30 Bar Update: 1336; Bar Time 10630 ........ ........
Could it be that it goes back 43200 bars as market analyzer look back period i set? It should NOT be correlated, but i can't explain in any other way....
help....
Comment