Could you spare few minutes to explain to me for more clear understanding about the condition CloseOnOppositeSignal.
Contrary to CloseTradesOnRelevantSemafor or CloseOnOppositeSignal where there are distinct parameters like SemStatus == highsemafor /SemStatus == lowsemafor or BuySignal/SellSignal.
There is only one condition for WaveStatus == Waverange (no waverange up or waverange down)
So my questionning is for this portion of code :
Code: Select all
if (CloseOnYellowRangeWave)
{
if (WaveStatus == Waverange)
{
tries = 0;
//Close buys
if (BuyOpen && (!OnlyCloseProfitablePositions || BuyPipsUpl > 0))
{
ForceTradeClosure = true;
while(ForceTradeClosure)
{
CloseAllTrades(OP_BUY);
if (BuyStopOpen)
CloseAllTrades(OP_BUYSTOP);
if (BuyLimitOpen)
CloseAllTrades(OP_BUYLIMIT);
if(GridType == Stop_Orders_Only && (DeleteAndReplaceWavyLosersGrid || !SellOpen))
CloseAllTrades(OP_SELLSTOP);
if (ForceTradeClosure)
Sleep(1000);
tries++;
if (tries >= 100)
{
ForceTradeClosure = false;
break;
}//if (tries >= 100)
}//while(ForceTradeClosure)
//Replace the grids for the stop orders method
if (GridType == Stop_Orders_Only)
{
if (ReplaceWavyWinnersGrid)
if (SellOpen)//open sells means the cycle has not ended and we want new buy stop orders ready in case market resumes its upward move
SendBuyGrid(Symbol(), OP_BUYSTOP, NormalizeDouble(Ask + (DistanceBetweenTrades / factor), Digits), SendLots);
if (DeleteAndReplaceWavyLosersGrid)
if (SellOpen)//open sells means the cycle has not ended and we want new sell stop orders much closer to the market
SendSellGrid(Symbol(), OP_SELLSTOP, NormalizeDouble(Bid - (DistanceBetweenTrades / factor), Digits), SendLots);
}//if (GridType == Stop_Orders_Only)
return;//Nothing more for this function to do
}//if (BuyOpen)
//Close sells
if (SellOpen && (!OnlyCloseProfitablePositions || SellPipsUpl > 0))
{
ForceTradeClosure = true;
while(ForceTradeClosure)
{
ForceTradeClosure = false;
CloseAllTrades(OP_SELL);
if (SellStopOpen)
CloseAllTrades(OP_SELLSTOP);
if (SellLimitOpen)
CloseAllTrades(OP_SELLLIMIT);
if (GridType == Stop_Orders_Only && (DeleteAndReplaceWavyLosersGrid || !BuyOpen))
CloseAllTrades(OP_BUYSTOP);
tries++;
if (tries >= 100)
{
ForceTradeClosure = false;
break;
}//if (tries >= 100)
}//while(ForceTradeClosure)
//Replace the grids for the stop orders method
if (GridType == Stop_Orders_Only)
{
if (ReplaceWavyWinnersGrid)
if (BuyOpen)//open buys means the cycle has not ended and we want new sell stop orders ready in case market resumes its downward move
SendSellGrid(Symbol(), OP_SELLSTOP, NormalizeDouble(Bid - (DistanceBetweenTrades / factor), Digits), SendLots);
if (DeleteAndReplaceWavyLosersGrid)
if (BuyOpen)//open buys means the cycle has not ended and we want new buy stop orders much closer to the market
SendBuyGrid(Symbol(), OP_BUYSTOP, NormalizeDouble(Ask + (DistanceBetweenTrades / factor), Digits), SendLots);
}//if (GridType == Stop_Orders_Only)
return;//Nothing more for this function to do
}//if (SellOpen)
}// if (WaveStatus == Waverange)
Of course there is security parameter PostTradeAttemptWaitSeconds so no problems.
But what I want to ask : is there a possibility result return from HGI for Waverange where we can distinct the "waverange up" or "waverange down" ?
Because I would like to set like Close Trades on Semafor with ReplaceWinnersByLimitGrid and AddStopOrdersToLimitGrid.
I've noticed the odds on continuing the trend after the YellowRangeWave is evenly or more often than the odds on Semafor that why I would like to test it.
What I mod to meet this requirement like a "amateur" is using MA filters to determine the condition "TradeLong" and "TradeShort" to distinct with waverange.
But not sure It's a clean solution.
Hai