Basically, my strategy always enters a position, and it never exits using my ExitLongStop or ExitShortStop commands. It only reverses positions when a EnterShortStop is triggered. I just realized this after major debugging and printing.
Here is the portion of my code with this logic. I'm assuming there is some fundamental thing that I'm missing. I hope someone can help.
if ( movAvgVal[0] > movAvgVal[1] )
{
EnterLongStop(upBand, "Long Buy");
}
else if ( movAvgVal[0] < movAvgVal[1])
{
EnterShortStop(dnBand, "Short Buy");
}
if ((Position.MarketPosition == MarketPosition.Long))
{
ExitLongStop(movAvgVal2[0], "Long Exit");
}
else if ((Position.MarketPosition == MarketPosition.Short))
{
ExitShortStop(movAvgVal2[0], "Buy to Cover");
}
}
The code will not run my ExitLongStop or ExitShortStop commands. If I change them to ExitLong() and ExitShort(), it will execute them, but it messes up the logic and testing. I need them to be stops.
Please help, I'm been at this non stop for 2 weeks.
Comment