Coding help - page 630

 
Hi Mladen, i need of attached filter image below.
Files:
filter.jpg  114 kb
 

I'm requesting for a simple Aroon EA.

Buy: When aroon up crosses above aroon down. Exit when aroon up crosses level 50 downwards or when an opposite signal occurs, whichever comes first. (Opposite signal means when aroon up crosses below aroon down)

Sell: When aroon down crosses above aroon up. Exit when aroon down crosses level 50 downwards or when an opposite signal occurs, whichever comes first. (Opposite signal means when aroon down crosses below aroon up)

All the trades should be opened on the open of the next candle after the signal occurs.

Set the stop loss at the previous swing high/swing low. If not possible to do so then use ATR stoploss or manual stoploss.

If possible please add money management feature too.

 

Your time, skills and generosity are so much appreciated. Regards

 

Reymaq. 

 
hi any one have fps buysell signal mq4? if yes means can you please share here .. i seen only ex4 files..
 

otherwise i want one help. in this indicator high low are showing with short yellow lines ... likes that after the price of low of the zigzag.. from the price itself need short lines for  0.326% ,0.5%, 0.618% , 1%, 1.618%,2.27%,2.618%,3.33%, 4,236% i means the fibo retracement is for that price alone which is like (after setting low) low+(low*0.326/100)............ low +(low*0.5/100)........... like...

after that for the high made means .... same procedure like short lines dotted

high-(high*0.326/100)........... high -(high*0.5/100)........

can you please any one do this for me?

i will be much thankful to u..

Files:
 

Hi,

I would like to test their two indicators in an EA.

1 - Parabolic SAR of KAMA 1_5.mq4

2 - Macd - std normalized.mq4 1_2 (Filter)


I'm testing with the code below to open orders.
I did back test for 3 months in H1.
The result was very bad.

There any way to improve the way of opening of orders?

Result

extern int    BarToUse    = 1;       // Bar to test (0, for still opened, 1 for first closed, and so on)
extern string     IndicatorsSettings   = "===== INDICATORS SETTINGS=====";
extern string     _Indicator           = "===== Parabolic SAR =====";
extern double    AccStep         = 0.02;      // Accumulation step
extern double    AccLimit        = 0.2;       // Accumulation limit
extern int       AmaPeriod       = 10;        // Kaufman AMA period
extern int  AmaPrice        = 0;  // Price to be used by Kaufman AMA
extern double    FastEnd         = 2;         // Kaufman AMA fast end
extern double    SlowEnd         = 30;        // Kaufman AMA slow end
extern double    SmoothPower     = 2;         // Smooth power
extern bool      JurikFDAdaptive = true;      // Should the Kaufman AMA be Jurik fractal dimension adaptive?
//extern enDisplayType DisplayType = "" ; // What should be displayed?
extern int       LineWidth       = 2;         // Lines width
extern int       ArrowsWidth     = 0;         // Arrows (dots) width
extern bool      Interpolate     = true;      // Interpolate in multi time frame mode?
extern string PARAMETERS_INDICATOR_TWO = "Macd";
extern int                FastMAPeriod  = 23;            // Fast macd period
extern int                SlowMAPeriod  = 50;            // Slow macd period
extern int                SignalPeriod  = 9;             // Signal period
extern int                StdPeriod     = 50;            // Standard deviation used for normalization
extern int Price         = 0;   // Price to use 
extern double             Filter        = 0;             // Filter to apply to macd value
extern int                FilterPeriod  = 0;             // Filter period to use (<= to use the slow macd period)
extern colorOn            ColorChangeOn = clrOnSlope;    // Color change on : 

#define _doNothing 0
#define _doBuy     1
#define _doSell    2
int start()
{
   //MagicWarning();//Display a warning in case MagicNumber is changed
   AutoMagic();//Generate Magic Number based on Symbol and Long/Short params
   
      int doWhat = _doNothing;
      double sarUp = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5",0,AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,0,BarToUse); 
      double sarDn = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5",0,AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,1,BarToUse+1); 
      
      double macdUp= iCustom(NULL,0,"Macd - std normalized 1_2 histo",0,FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,0,BarToUse);
      double macdDn= iCustom(NULL,0,"Macd - std normalized 1_2 histo",0,FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,1,BarToUse+1);
      
         

        
      if (sarUp!=sarDn & macdUp!=macdDn)
         if (sarUp<sarDn & macdUp<macdDn) //buy
               doWhat = _doBuy;
         else  doWhat = _doSell;
         if (doWhat==_doNothing && !DisplayInfo) return(0);

   if (doWhat==_doBuy && openedBuys==0)
      {
         RefreshRates();
         //double BStopLossLevel   = Ask - StopLoss   *myPoint;
         //double BTakeProfitLevel = Ask + TakeProfit *myPoint;               
         double stopLossBuy   = 0; if (StopLoss>0)   stopLossBuy   =Ask - StopLoss   *myPoint; //Ask-StopLoss*Point*MathPow(10,Digits%2);
         double takeProfitBuy = 0; if (TakeProfit>0) takeProfitBuy =Ask + TakeProfit *myPoint; //Ask+TakeProfit*Point*MathPow(10,Digits%2);
         if (EcnBroker)
         {
            int ticketb = OrderSend(Symbol(),OP_BUY,LotSize,NormalizeDouble(Ask,digit),Slippage*myPoint,0,0,EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_B",MagicNumber,0,Blue);
            if (ticketb>-1)
               dummyResult = OrderModify(ticketb,OrderOpenPrice(),NormalizeDouble(stopLossBuy,digit),NormalizeDouble(takeProfitBuy,digit),0,CLR_NONE);
              
              
         }
         else dummyResult = OrderSend(Symbol(),OP_BUY,LotSize,NormalizeDouble(Ask,digit),Slippage*myPoint,NormalizeDouble(stopLossBuy,digit),NormalizeDouble(takeProfitBuy,digit),EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_B",MagicNumber,0,Blue);
          
      }
   if (doWhat==_doSell && diStcSell==true && openedSells==0)
      {
         RefreshRates();
         //double SStopLossLevel   = Bid + StopLoss   *Mypoint;
         //double STakeProfitLevel = Bid - TakeProfit *Mypoint;
         double stopLossSell   = 0; if (StopLoss>0)   stopLossSell=Bid + StopLoss   *myPoint; //Bid+StopLoss*Point*MathPow(10,Digits%2);
         double takeProfitSell = 0; if (TakeProfit>0) takeProfitSell =Bid - TakeProfit *myPoint; //Bid-TakeProfit*Point*MathPow(10,Digits%2);
         if (EcnBroker)
         {
            int tickets = OrderSend(Symbol(),OP_SELL,LotSize,NormalizeDouble(Bid,digit),Slippage*myPoint,0,0,EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_S",MagicNumber,0,Red);
            if (tickets>-1)
                dummyResult = OrderModify(tickets,OrderOpenPrice(),NormalizeDouble(stopLossSell,digit),NormalizeDouble(takeProfitSell,digit),0,CLR_NONE);
         }
         
         else dummyResult = OrderSend(Symbol(),OP_SELL,LotSize,NormalizeDouble(Bid,digit),Slippage*myPoint,NormalizeDouble(stopLossSell,digit),NormalizeDouble(takeProfitSell,digit),EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_S",MagicNumber,0,Red);
 
borgesr:

Hi,

I would like to test their two indicators in an EA.

1 - Parabolic SAR of KAMA 1_5.mq4

2 - Macd - std normalized.mq4 1_2 (Filter)


I'm testing with the code below to open orders.
I did back test for 3 months in H1.
The result was very bad.

There any way to improve the way of opening of orders?

Please read this post : https://www.mql5.com/en/forum/186208/page3 about eventual optimization. As of why it works like that : you probably could revise the rules you are using when orders are opened and closed. But in any case, check the rules you are using and check when your orders are closed
 
ramzam:

otherwise i want one help. in this indicator high low are showing with short yellow lines ... likes that after the price of low of the zigzag.. from the price itself need short lines for  0.326% ,0.5%, 0.618% , 1%, 1.618%,2.27%,2.618%,3.33%, 4,236% i means the fibo retracement is for that price alone which is like (after setting low) low+(low*0.326/100)............ low +(low*0.5/100)........... like...

after that for the high made means .... same procedure like short lines dotted

high-(high*0.326/100)........... high -(high*0.5/100)........

can you please any one do this for me?

i will be much thankful to u..

I can not check the file per moment. but seeing the name, are you sure that using zigzag for signals can be used the way you are expecting it (being that zigzag repaints)?
 
mladen:
Please read this post : https://www.mql5.com/en/forum/186208/page3 about eventual optimization. As of why it works like that : you probably could revise the rules you are using when orders are opened and closed. But in any case, check the rules you are using and check when your orders are closed

Dear Mladen,

The opening rule was wrong.

I changed the code but still continues with a very poor performance losing a lot of money.


To make the filter along with the Parabolic would be better to use RSI?

      int doWhat = _doNothing;
      double sarUp = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5",0,AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,0,BarToUse); 
      double sarDn = iCustom(NULL,0,"Parabolic SAR of KAMA 1_5",0,AccStep,AccLimit,AmaPeriod,AmaPrice,FastEnd,SlowEnd,SmoothPower,JurikFDAdaptive,1,BarToUse+1); 
      
      double macdUp= iCustom(NULL,0,"Macd - std normalized 1_2 histo",0,FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,0,BarToUse);
      double macdDn= iCustom(NULL,0,"Macd - std normalized 1_2 histo",0,FastMAPeriod,SlowMAPeriod,SignalPeriod,StdPeriod,Price,Filter,FilterPeriod,ColorChangeOn,1,BarToUse+1);
      
         

        
      
         if (sarUp<sarDn & macdUp<macdDn) doWhat = _doBuy;
         if (sarUp>sarDn & macdUp>macdDn)  doWhat = _doSell;
         if (doWhat==_doNothing && !DisplayInfo) return(0);
         
  for (int i = OrdersTotal()-1; i>=0; i--)
   {
      if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
      if (OrderSymbol()      != Symbol())            continue;
      if (OrderMagicNumber() != MagicNumber)         continue;

      //
      //
      //
      //
      //
      
      if (DisplayInfo) currentProfit += OrderProfit()+OrderCommission()+OrderSwap();
         
         //
         //
         //
         //
         //
         
         if (OrderType()==OP_BUY)
            if (doWhat==_doSell )
                  { RefreshRates(); if (!OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Orange)) openedBuys++; }
            else  openedBuys++;
         if (OrderType()==OP_SELL)
            if (doWhat==_doBuy )
                  { RefreshRates(); if (!OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Green)) openedSells++; }
            else  openedSells++;            
   }
   if (DisplayInfo) Comment("Current profit : "+DoubleToStr(currentProfit,2)+" "+AccountCurrency()); if (doWhat==_doNothing) return(0);

   //
   //
   //
   //
   //
   if (doWhat==_doBuy && openedBuys==0)
      {
         RefreshRates();
         //double BStopLossLevel   = Ask - StopLoss   *myPoint;
         //double BTakeProfitLevel = Ask + TakeProfit *myPoint;               
         double stopLossBuy   = 0; if (StopLoss>0)   stopLossBuy   =Ask - StopLoss   *myPoint; //Ask-StopLoss*Point*MathPow(10,Digits%2);
         double takeProfitBuy = 0; if (TakeProfit>0) takeProfitBuy =Ask + TakeProfit *myPoint; //Ask+TakeProfit*Point*MathPow(10,Digits%2);
         if (EcnBroker)
         {
            int ticketb = OrderSend(Symbol(),OP_BUY,LotSize,NormalizeDouble(Ask,digit),Slippage*myPoint,0,0,EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_B",MagicNumber,0,Blue);
            if (ticketb>-1)
               dummyResult = OrderModify(ticketb,OrderOpenPrice(),NormalizeDouble(stopLossBuy,digit),NormalizeDouble(takeProfitBuy,digit),0,CLR_NONE);
              
              
         }
         else dummyResult = OrderSend(Symbol(),OP_BUY,LotSize,NormalizeDouble(Ask,digit),Slippage*myPoint,NormalizeDouble(stopLossBuy,digit),NormalizeDouble(takeProfitBuy,digit),EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_B",MagicNumber,0,Blue);
          
      }
   if (doWhat==_doSell & openedSells==0)
      {
         RefreshRates();
         //double SStopLossLevel   = Bid + StopLoss   *Mypoint;
         //double STakeProfitLevel = Bid - TakeProfit *Mypoint;
         double stopLossSell   = 0; if (StopLoss>0)   stopLossSell=Bid + StopLoss   *myPoint; //Bid+StopLoss*Point*MathPow(10,Digits%2);
         double takeProfitSell = 0; if (TakeProfit>0) takeProfitSell =Bid - TakeProfit *myPoint; //Bid-TakeProfit*Point*MathPow(10,Digits%2);
         if (EcnBroker)
         {
            int tickets = OrderSend(Symbol(),OP_SELL,LotSize,NormalizeDouble(Bid,digit),Slippage*myPoint,0,0,EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_S",MagicNumber,0,Red);
            if (tickets>-1)
                dummyResult = OrderModify(tickets,OrderOpenPrice(),NormalizeDouble(stopLossSell,digit),NormalizeDouble(takeProfitSell,digit),0,CLR_NONE);
         }
         
         else dummyResult = OrderSend(Symbol(),OP_SELL,LotSize,NormalizeDouble(Bid,digit),Slippage*myPoint,NormalizeDouble(stopLossSell,digit),NormalizeDouble(takeProfitSell,digit),EASHORTNAME+"_"+Symbol()+"("+GetChartTimeFrame()+")_S",MagicNumber,0,Red);
      }
   return(0);
}
 
borgesr:

Dear Mladen,

The opening rule was wrong.

I changed the code but still continues with a very poor performance losing a lot of money.


To make the filter along with the Parabolic would be better to use RSI?

Please, try to optimize your EA

 
kapoo:

Mr. Mladen, please look at the below codes , the arrow doesnt come up in live until i switched time frame.


That is a repainting version of sidus indicator

Non repainting version can be downloaded from here : https://www.mql5.com/en/forum/180648/page293