Opening of order problem

 


Good day everyone


I please need help with the following. I am new to coding and are trying to create my own EA to trade the crash 500 market in MT5. The idea is for an order to open when the RSI reach 90 and then open a new order every 6 candles(1 minute timeframe) Let say the first order opens and the market makes a small drop , but not enough to hit my TP but brings the RSI level below 90 again. When it goes back up and reach RSI 90 again even if my first order is still open I want it to add one more order. Thus it should enter a new trade every time when the RSI reach 90 even if there are stil orders open. I could not get it right for it to open a new trade every 6 candles after the RSI has reached 90 thus I created it to open 3 orders on different RSI levels and I am happy with it that way but I please need help to have it open more orders once the RSI drops but TP was not reached. At this moment it opens on RSI 90(1st order) but if the market drops to let say 80 and TP was not achieved yet it stars to move up again but does not enter a new trade again on 90  

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   
 // We calculate the Ask price
             double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
 // We calculate the Bid Price
             double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);
 // We create an Array for several prices
             double RSIArray[];
 // We sort the price array from the current candle downwards
             ArraySetAsSeries(RSIArray,true);
 // We define the properties of the RSI
             int RSIDefinition = iRSI(_Symbol,_Period,RsiLevel,PRICE_CLOSE);
 // Define the EA, current candle,3 candles, store result
             CopyBuffer(RSIDefinition,0,0,3,RSIArray); 
 // We calculate EA  for the current candle
             double RSIValue=NormalizeDouble(RSIArray[0],1);
 // We open a sell position if RSI> declared value
             if (PositionsTotal()==0&&RSIValue>90)  
             {
             trade.Sell(LotSize1,NULL,Bid,(Bid+StopLoss1*_Point),Bid-TakeProfit1*_Point,NULL);     
  }
  
// We open a sell position if RSI> declared value
             if (PositionsTotal()==1&&RSIValue>93)  
             {
             trade.Sell(LotSize2,NULL,Bid,(Bid+StopLoss2*_Point),Bid-TakeProfit2*_Point,NULL);
     
  }
 // We open a sell position if RSI> declared value
             if (PositionsTotal()==2&&RSIValue>96)  
             {
             trade.Sell(LotSize3,NULL,Bid,(Bid+StopLoss3*_Point),Bid-TakeProfit3*_Point,NULL);    
  } 
           
  
  
  }
 
Dawid Zinserling: I please need help with the following.

Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
          No free help (2017)

Reason: