diff --git a/Experts/Nkanven/GeminiHedge.ex5 b/Experts/Nkanven/GeminiHedge.ex5 index 70055d7..90d9ade 100644 Binary files a/Experts/Nkanven/GeminiHedge.ex5 and b/Experts/Nkanven/GeminiHedge.ex5 differ diff --git a/Experts/Nkanven/GeminiHedge.mq5 b/Experts/Nkanven/GeminiHedge.mq5 index 52284de..a6ba695 100644 --- a/Experts/Nkanven/GeminiHedge.mq5 +++ b/Experts/Nkanven/GeminiHedge.mq5 @@ -46,29 +46,24 @@ void OnTick() if(InpActivateDCAHedging) { - Print("DCA Hedging is activated"); - ArrayResize(instruments,2); + Print("DCA Hedging is activated"); + ArrayResize(instruments,2); instruments[0] = InpInstrument1; instruments[1] = InpInstrument2; } else { - Print("DCA Hedging is not activated"); - ArrayResize(instruments,1); + Print("DCA Hedging is not activated"); + ArrayResize(instruments,1); instruments[0] = InpInstrument1; } -Print("Instrument size", ArraySize(instruments)); for(int i=0; i 0) { - //Get last opened position id - int lastTicketId = gTotalBuyPositions; - bool hasOrderAbove = false, hasOrderBelow = false; if(PositionGetTicket(lastTicketId) == 0) { int Error=GetLastError(); - Print("ERROR - Unable to select the order - ",Error," - ",Error); + Print("ERROR - Unable to select the position - ",Error," - ",Error); return NO_DEALS; } - - if(PositionGetSymbol(lastTicketId)==gSymbol && PositionGetInteger(POSITION_MAGIC)==InpMagicNumber) + if(PositionSelect(gSymbol)) { - //Compute above and below orders price - - Print("Last ticket id ", lastTicketId, " last ticket price ", PositionGetDouble(POSITION_PRICE_OPEN)); - gUpOpenPrice = PositionGetDouble(POSITION_PRICE_OPEN) + (InpBuyCallBack * point); - gDownOpenPrice = PositionGetDouble(POSITION_PRICE_OPEN) - (InpBuyCallBack * point); - - //Check orders around the last opened position - for(int i=0; i