Liquidity_Predator/Strategy/M_SM_IN_TRADE.mqh

55 lines
1.6 KiB
MQL5
Raw Permalink Normal View History

2026-01-31 07:59:15 +01:00
void M_SM_IN_TRADE()
{
stGVL.LastFVGTop = 0;
stGVL.LastFVGBottom = 0;
if(PositionsTotal() > 0) // Open Position
{
2026-04-21 21:00:36 +02:00
if(!stGVL.bTPChecked)
{
stGVL.bTPChecked = M_RecalculateTP();
}
2026-01-31 07:59:15 +01:00
if(stGVL.eCurrentDirection == DIR_LONG)
{
2026-03-18 18:34:48 +01:00
if(stGVL.bRunnerPosition_CheckClose)
{
M_CloseRunner(M_EMACloseBuy());
M_CheckRunnerToTP1();
}
else if(stGVL.Candle[0].high > stGVL.Entry + (stGVL.TakeProfit - stGVL.Entry) * (nMoveBeAtProfit / 100) && nMoveBeAtProfit != 0 && !stGVL.MovedBE)
2026-01-31 07:59:15 +01:00
{
stGVL.MovedBE = M_AllSLToEntry(); // Move all SL to entry when reached a certain amount of profit
if(bRunnerPosition)
{
stGVL.bRunnerPosition_CheckClose = true;
}
2026-01-31 07:59:15 +01:00
}
2026-03-18 18:34:48 +01:00
}
else if(stGVL.eCurrentDirection == DIR_SHORT)
{
if(stGVL.bRunnerPosition_CheckClose)
{
2026-03-18 18:34:48 +01:00
M_CloseRunner(M_EMACloseSell());
M_CheckRunnerToTP1();
}
2026-03-18 18:34:48 +01:00
else if(stGVL.Candle[0].low < stGVL.Entry - (stGVL.Entry - stGVL.TakeProfit) * (nMoveBeAtProfit / 100) && nMoveBeAtProfit != 0 && !stGVL.MovedBE)
2026-01-31 07:59:15 +01:00
{
stGVL.MovedBE = M_AllSLToEntry(); // Move all SL to entry when reached a certain amount of profit
// Check to close runner position as soon tp1 hit
if(bRunnerPosition)
{
stGVL.bRunnerPosition_CheckClose = true;
}
2026-01-31 07:59:15 +01:00
}
}
}
else
{
2026-02-11 19:29:28 +01:00
M_LogInfo("Trade closed");
2026-01-31 07:59:15 +01:00
stGVL.nStateMachine = SM_RESET;
}
}