I know my code isn't very efficient, I'm in the process of creating a boilerplate template and I'm very much in the trial-and-error stage.
Here's the code snippet from this attempt to modify the stop, let me know if I should paste more code.
I must be doing something wrong, one of the errors it throws tells me I'm trying to put the stop below the market but according to my printouts that's not the case.
Code:
//TRAIL SHORT
if ((Highs[1][0]+stopBufferTicks*TickSize) < origStopPriceShorts && moveStopBool && okToTrailShort)
{
Print(Times[1][0]);
Print("Current Stop: " + currStopPrice + " New stop : " + (Highs[1][0]+stopBufferTicks*TickSize) + " Original stop location: " + origStopPriceShorts);
Print("Current High: " + Highs[1][0]);
Print("Current Low: " + Lows[1][0]);
if (entryOrderShort != null && (currStopPrice > (Highs[1][0]+stopBufferTicks*TickSize)))
{
ExitShortStopMarket(1, true, Position.Quantity, newStopPriceShorts,"short exit","short entry");
}
}
Comment