2026-01-31 07:59:15 +01:00
|
|
|
bool M_CheckLiquCrossed()
|
|
|
|
|
{
|
|
|
|
|
// Check if sellside liquidity got activated (crossed)
|
|
|
|
|
for(int i = 0; i <= ArraySize(stGVL.SellLiquidity) - 1; i++)
|
|
|
|
|
{
|
2026-05-10 20:37:44 +02:00
|
|
|
if(stGVL.Candle[1].high > stGVL.SellLiquidity[i]) // check the last closed candle and not the current one to increase performance
|
2026-01-31 07:59:15 +01:00
|
|
|
{
|
2026-03-18 20:10:33 +01:00
|
|
|
if(stGVL.nStateMachine == SM_IN_TRADE) // In trade, do nothing
|
2026-03-15 10:56:32 +01:00
|
|
|
{
|
2026-03-18 20:10:33 +01:00
|
|
|
M_LogInfo("Sellside liquidity activated and deleted because in trade" + DoubleToString(stGVL.SellLiquidity[i]));
|
2026-03-15 10:56:32 +01:00
|
|
|
}
|
2026-03-18 20:10:33 +01:00
|
|
|
else
|
2026-01-31 07:59:15 +01:00
|
|
|
{
|
2026-03-18 20:10:33 +01:00
|
|
|
stGVL.CurrentLiquidity = stGVL.SellLiquidity[i];
|
|
|
|
|
stGVL.dtCurrentLiquidity_Time = stGVL.Candle[1].time; // save time of Liquidity activation
|
|
|
|
|
stGVL.eCurrentDirection = DIR_SHORT;
|
|
|
|
|
stGVL.Line_ActLiqu_Number = stGVL.Line_ActLiqu_Number + 1;
|
|
|
|
|
M_SetLine(stGVL.Line_ActLiqu, stGVL.Line_ActLiqu_Number, stGVL.CurrentLiquidity, clrOrange);
|
|
|
|
|
|
|
|
|
|
if(stGVL.Candle[1].high - stGVL.CurrentLiquidity > stGVL.fMaxDiffTakeOut_Price && stGVL.fMaxDiffTakeOut_Price!=0)
|
|
|
|
|
{
|
|
|
|
|
M_LogWarning("Sell-Liquidity got taken out " + DoubleToString(stGVL.Candle[1].high - stGVL.CurrentLiquidity));
|
|
|
|
|
stGVL.CurrentLiquidity = 0;
|
|
|
|
|
stGVL.nStateMachine = SM_RESET;
|
|
|
|
|
}
|
2026-03-25 19:58:50 +01:00
|
|
|
else if(!M_PatternBeforeLiquOK())
|
|
|
|
|
{
|
|
|
|
|
stGVL.CurrentLiquidity = 0;
|
|
|
|
|
stGVL.nStateMachine = SM_RESET;
|
|
|
|
|
}
|
2026-03-18 20:10:33 +01:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string Message = "Sellside liquidity activated at " + DoubleToString(stGVL.CurrentLiquidity);
|
|
|
|
|
M_LogInfo(Message);
|
|
|
|
|
stGVL.nStateMachine = SM_LIQUIDITY_ACTIVATED;
|
|
|
|
|
}
|
2026-01-31 07:59:15 +01:00
|
|
|
}
|
2026-03-18 20:10:33 +01:00
|
|
|
|
|
|
|
|
stGVL.SellLiquidity[i] = 100000000000; // Reset value to 100_000_000_000 so it can never get activated
|
2026-01-31 07:59:15 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if buyside liquidity got activated (crossed)
|
|
|
|
|
for(int i = 0; i <= ArraySize(stGVL.SellLiquidity) - 1; i++)
|
|
|
|
|
{
|
2026-05-10 20:37:44 +02:00
|
|
|
if(stGVL.Candle[1].low < stGVL.BuyLiquidity[i]) // check the last closed candle and not the current one to increase performance
|
2026-01-31 07:59:15 +01:00
|
|
|
{
|
2026-03-18 20:10:33 +01:00
|
|
|
if(stGVL.nStateMachine == SM_IN_TRADE) // In trade, do nothing
|
2026-03-15 10:56:32 +01:00
|
|
|
{
|
2026-03-18 20:10:33 +01:00
|
|
|
M_LogInfo("Sellside liquidity activated and deleted because in trade" + DoubleToString(stGVL.BuyLiquidity[i]));
|
2026-03-15 10:56:32 +01:00
|
|
|
}
|
2026-03-18 20:10:33 +01:00
|
|
|
else
|
2026-01-31 07:59:15 +01:00
|
|
|
{
|
2026-03-18 20:10:33 +01:00
|
|
|
stGVL.CurrentLiquidity = stGVL.BuyLiquidity[i];
|
|
|
|
|
stGVL.dtCurrentLiquidity_Time = stGVL.Candle[1].time; // save time of Liquidity activation
|
|
|
|
|
stGVL.eCurrentDirection = DIR_LONG;
|
|
|
|
|
stGVL.Line_ActLiqu_Number = stGVL.Line_ActLiqu_Number + 1;
|
|
|
|
|
M_SetLine(stGVL.Line_ActLiqu, stGVL.Line_ActLiqu_Number, stGVL.CurrentLiquidity, clrOrange);
|
|
|
|
|
|
|
|
|
|
if(stGVL.CurrentLiquidity - stGVL.Candle[1].low > stGVL.fMaxDiffTakeOut_Price && stGVL.fMaxDiffTakeOut_Price!=0)
|
|
|
|
|
{
|
|
|
|
|
M_LogWarning("Buy-Liquidity got taken out " + DoubleToString(stGVL.CurrentLiquidity - stGVL.Candle[1].low));
|
|
|
|
|
stGVL.CurrentLiquidity = 0;
|
|
|
|
|
stGVL.nStateMachine = SM_RESET;
|
|
|
|
|
}
|
2026-03-25 19:58:50 +01:00
|
|
|
else if(!M_PatternBeforeLiquOK())
|
|
|
|
|
{
|
|
|
|
|
stGVL.CurrentLiquidity = 0;
|
|
|
|
|
stGVL.nStateMachine = SM_RESET;
|
|
|
|
|
}
|
2026-03-18 20:10:33 +01:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string Message = "Buyside liquidity activated at " + DoubleToString(stGVL.CurrentLiquidity);
|
|
|
|
|
M_LogInfo(Message);
|
|
|
|
|
stGVL.nStateMachine = SM_LIQUIDITY_ACTIVATED;
|
|
|
|
|
}
|
2026-01-31 07:59:15 +01:00
|
|
|
}
|
2026-03-18 20:10:33 +01:00
|
|
|
|
|
|
|
|
stGVL.BuyLiquidity[i] = 0; // Reset value to 0 so it can never get activated
|
2026-01-31 07:59:15 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|