price that you set in the strategy
So you get a gazillion order fills at each tick (because of the 1 tick range secondary chart series) and stop outs. Nothing like what you would expect. I went insane trying to see where the bug was in my code, so i finally just tried it for real
and it worked fine. Here is the set up:
Run the strategy as a Point and Figure with: ticks, 1 base period, 1 box , and 10 reversal
Initialisation routine:
SetStopLoss("Short", CalculationMode.Ticks, stop_ticks, false);
SetProfitTarget("Short", CalculationMode.Ticks, profit_ticks);
SetStopLoss("Long", CalculationMode.Ticks, stop_ticks, false);
SetProfitTarget("Long", CalculationMode.Ticks, profit_ticks);
Add(PeriodType.Range, 1); // secondary time frame
Note: the values of ticks set set correctly.
OnBarUpdate() routine:
if(BarsInProgress == 0) do a strategy and set a flag to trigger something
in the BarsInProgress == 1 time frame.
if(BarsInProgress == 1):
If flag from BarsInProgress == 0 was set:
Short = EnterShortLimit(0, true, DefaultQuantity, Variable, "Short");
or depending on the flag direction.
Long = EnterLongLimit(0, true, DefaultQuantity, Variable, "Long");
Note: Variable has the correct value
Like I said, in forward test, it runs fine. Back testing the orders make no sense. Even back testing
the variables for Variable, stop_ticks and profit_ticks - all printed out correct in the output window.
The orders simulated by the back test are just wild. I think Ninja gets confused with P&F charts and an
added tick secondary time frame series. I turned trace orders on and it is no help. It just confirms what I already said,
nothing other was unusual.

Comment