In one of my strategies after a certain signal I want to go from 1 Short position to 1 Long position.
But I have this problem: When I am 1 Short and there is a Long signal, my strat goes sometimes in a double (2) Long position.
Questions:
- Does anyone know what I am doing wrong?
- When position is 1 Short and command is EnterLong, is the position then Flat or 1 Long?
I have CalculateOnBarClose = True.
Quantity's are always 1.
Here's the corresponding code after the signal:
if ( (Position.MarketPosition == MarketPosition.Short)
)
{
ExitShort(QuantShort1, "Exit ShortOpSTnr1", "ShortOpSTnr1");
if ( tijdok == "ja") {EnterLong(QuantLong1, "LongOpSTnr1");} //
}
TIA,
Anne
Comment