Please have a look at my strategy's buy and sell triggers below.
I want to make it work as follows:
When long the "exitlongstop" or entershortstop must exit the trade (and go short in the case of the entershortstop)
The problem is that the long positions are aways only exited by the exitlongstop - the entershortstop never exits the long = even though I can see on the chart that the conditions for the entershortstop is true.
Please show me what I am doing wrong
Same is true for exiting from short position
// Buy trigger
if (MyDmipp[0] > MyDmimm[0])
{
HighestHighforlong = MAX(High,3)[0];
EnterLongStop(HighestHighforlong);
}
if (Position.MarketPosition == MarketPosition.Long)
{
LowestLowforstop = MIN (Low,4)[BarsSinceEntry()];
ExitLongStop(LowestLowforstop);
}
// Sell trigger
if (MyDmipp[0] < MyDmimm[0])
{
LowestLowforshort = MIN(Low,3)[0];
EnterShortStop(LowestLowforshort);
}
if (Position.MarketPosition == MarketPosition.Short)
{
HighestHighforstop = MAX (High,4)[BarsSinceEntry()];
ExitShortStop(HighestHighforstop);
}

Comment