I would like to create some sort of a safety mechanic in my code so that my trades will be closed if price decides to jump over the Profit/Loss targets during the Close and Open of the day gaps.
Currently I have this piece of code that assigns the Profit (TP) and Loss (SL) targets to the L1 trade:
if (L1 != null && L1 == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled)
{
TP = ExitLongLimit(0, true, 1, Close[1] + 1 * TickSize, "TP", "L1");
SL = ExitLongStopLimit (0, true, 1, KyoriBands(TwentyFive, Fifty, SeventyFive).Low2[0], KyoriBands(TwentyFive, Fifty, SeventyFive).Low2[0], "SL", "L1");
}
}
My question is whether it's possible to use the TP and SL values to create something like...
if (Order is Long && Close[0] > TP)
{
ExitLong(L1);
}
I am looking forward to your reply and I thank you in advance for your time to answer my question.
All the best,
Law

Comment