there are several questions about how to scale in and to scale out with NinjaTrader. Scale in and scale out is possible with different entry-names (it is also possible with one entry-name and using exitshortstop/exitlongstop but I want to be clear about setstoploss).
When there are eg 2 setups for entries with different names
kL1a (scale in 1)
kL1b (scale in 2)
kL1c (scale in 3)
(auto entry long at key-reversalbar)
mL1a
mL1b
mL1c
(manual entry long 3 contracts)
For having accurate stoplosses one need to do
SetStopLoss("kL1a",CalculationMode.Ticks, x, false);
SetStopLoss("kL1b",CalculationMode.Ticks, y, false);
SetStopLoss("kL1c",CalculationMode.Ticks, z, false);
SetStopLoss("mL1a",CalculationMode.Ticks, x, false);
SetStopLoss("mL1b",CalculationMode.Ticks, y, false);
SetStopLoss("mL1c",CalculationMode.Ticks, z, false);
We do an entry with one of the setups, eg the "kL1" entries are filled.
The output window shows (even when there is only entry kL1a, kL1b and kL1c):
17.11.2013 03:50:59 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='kL1a' Mode=Ticks Value=8 Currency=0 Simulated=False
17.11.2013 03:50:59 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='kL1b' Mode=Ticks Value=9 Currency=0 Simulated=False
17.11.2013 03:50:59 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='kL1c' Mode=Ticks Value=10 Currency=0 Simulated=False
17.11.2013 03:50:59 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='mL1a' Mode=Ticks Value=8 Currency=0 Simulated=False
17.11.2013 03:50:59 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='mL1b' Mode=Ticks Value=9 Currency=0 Simulated=False
17.11.2013 03:50:59 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='mL1c' Mode=Ticks Value=10 Currency=0 Simulated=False
17.11.2013 03:50:59 Entered internal SetStopTarget() method: Type=Stop
Chart trader shows correctly 3 stops for kL1a, kL1b and kL1c.
Why do appear the stoplosses for both setups in outputwindow? Can there be issues in live-trading with these stops? Is it possbile that there are eg 3 entries but 2x3 stoplosses on the exchange, so that one can have naked positions when market turns other direction?
And referring to the "samplescaleout" I want to ask if the "basic" setstoploss immediately with the entry should be in initialize like in samplescaleout or it should be in onbarupdate with "if Position...flat" like in other samples.
Thank you in advance for clearifying this for everyone who tries to scalein and scaleout and is not a programmer or working with Iorders
Best regards
Tony
Comment