Announcement

Collapse
No announcement yet.

Media con Livelli

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Media con Livelli

    Buona sera a tutti sto creando un ea che funziona su una media con "livello superiore e inferiore" ora il codice è il seguente:
    PHP Code:
         int BuySell=0;
         
    double SLBuy 0TPBuy=0SLSell 0TPSell =0Vol=0;
         
    double Ma iMA(NULL0MediaPeriod0TipoMediaPRICE_CLOSE0);
         
    bool ticket;
         
    double  LivelloDownBuy Ma +  (Level_Negativo_Down_buy Point());
         
    double  LivelloUpSell Ma +  (Level_Positivo_Up_Sell Point());
         if((
    OrdiniAperti() == false))
         {
            if(
    Open[1] < Close[1]  && Close[1] < LivelloDownBuy && Open[1] > LivelloDownBuy)  //buy
               
    {
                
    BuySell =1;
                
    SLBuy Low[0] - dStopLevel StopLoss  p;
                
    TPBuy =Ma;//Bid + TakeProfit * 10 * Point;
               //Comment("Buy" + "\nentrata: " + NormalizeDouble(Ask,Digits)+ "\nSL Buy" + SLBuy + "\nTake Profit:"+DoubleToString(TPBuy,Digits)+"\nStopLevel " + dStopLevel +"\nCalcola Size " + Vol);

                
    ticket OrderSend(Symbol(),OP_BUY,Lotti,Ask,0,SLBuyTPBuy,"MovingAvarageLevels Buy",MagicNumber,0,Blue);
                if(
    ticket == false)
                   Print(
    "Error modifying order!, error#"GetLastError());
               }
            if(
    Open[1] >Close[1] && Open[1] >LivelloUpSell && Close[1] < LivelloUpSell)//sell
               
    {
                
    BuySell =-1;
                
    SLSell =High[0]+ dStopLevelStopLoss *p
                
    TPSell =Ma;       //Ask - TakeProfit * 10 * Point;

                //Vol=CalcolaSize(OprationRisk,Ask + StopLoss);
                //Comment("Sell" "\nBid: " + Bid + "\nSL Sell" + SLSell+ "\nTP Sell" + TPSell + "\nStopLevel " + dStopLevel +"\nCalcola Size " + Vol+ "\n StopLoss:" +  StopLoss+  "\nPoint" + Point + "\n StopLoss * Point"+  StopLoss * Point);

                
    ticket OrderSend(Symbol(),OP_SELL,Lotti,Bid,0,SLSellTPSell"MovingAvarageLevels Sell ",MagicNumber,0,Red);
                if(
    ticket == false)
                   Print(
    "Error modifying order!, error#"GetLastError());
               }

         }
         else if(
    OrdiniAperti() == true)
         {
          
    TpModify(Ma);
         }

          } 
    Non riesco a capire perchè apre solo operazioni sell non riesco a trovare l'errore qualcuno mi può dare una mano?
Working...
X