ea not trading after creating using etasoft with custom indicator

 

please help me with an ea of this indicator to automatically open orders on blue arrow/red arrow

order should close automatically on next blue/red arrow at the same time open a new order..

Thanks

the indicator is the white zigzag line on this picture below..

screenshot


//+------------------------------------------------------------------+
//|                                                       zigzag.mq4 |
//|                                                        Abu Saidu |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "ask4abusaidu@gmail.com"
#property link      "ggg.com"


#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 White

#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 2

//---- input parameters
extern int RISK=3;
extern int SSP=9;
 int CountBars=500;
 int Alert_Delay_In_Seconds=0;
extern bool Enablemail = false;
 string subjectUp="Buy signal";
 string subjectDown="Sell signal";
 string textUp="Long ";
 string textDown="Short ";

int PrevAlertTime=0;

//---- buffers
double val1[];
double val2[];
double alertBar;
double Mainbuffer[];
double UpperBuffer[];
double LowerBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
   IndicatorDigits( Digits );
   
   string short_name;
   //---- indicator line
   IndicatorBuffers(5);
   
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,233);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,234);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
   
   //---- drawing settings
   SetIndexStyle(2,DRAW_SECTION);
   //---- indicator buffers mapping
   SetIndexBuffer(2,Mainbuffer);
   SetIndexBuffer(3,UpperBuffer);
   SetIndexBuffer(4,LowerBuffer);
   
   SetIndexLabel(0, "UP");
   SetIndexLabel(1, "DOWN");
   SetIndexLabel(2, "Potential targets");
   
   SetIndexEmptyValue(0, 0);
   SetIndexEmptyValue(1, 0);
   SetIndexEmptyValue(2, 0);
   
   //----
   return( 0 );
}
//+------------------------------------------------------------------+
//| 
//+------------------------------------------------------------------+
int start()
{
Comment("Free usage allowed Property of www.trendsignal.co.in");

   if (CountBars>=Bars) CountBars=Bars;
   SetIndexDrawBegin(0,Bars-CountBars+SSP);
   SetIndexDrawBegin(1,Bars-CountBars+SSP);
   int i,shift,counted_bars=IndicatorCounted();
   int i1,i2,K;
   double Range,AvgRange,smin,smax,SsMax,SsMin,price;
   bool uptrend,old;
   //----
   
   if(Bars<=SSP+1) return(0);
   //---- initial zero
   if( counted_bars < SSP+1 ) {
      for(i=1;i<=SSP;i++) val1[CountBars-i]=0.0;
      for(i=1;i<=SSP;i++) val2[CountBars-i]=0.0;
   }
   //----
   
   K = 33-RISK;
   for( shift = CountBars-SSP; shift>=0; shift-- ) {
      Range=0;
      AvgRange=0;
      
      for( i1=shift; i1<=shift+SSP; i1++ ) {
         AvgRange=AvgRange+MathAbs(High[i1]-Low[i1]);
      }
      Range = AvgRange/(SSP+1);
      
      SsMax = High[shift]; SsMin=Low[shift];
      
      for( i2=shift;i2<=shift+SSP-1;i2++ ) {
         price=High[i2];
         if(SsMax<price) SsMax=price;
         price=Low[i2];
         if(SsMin>=price) SsMin=price;
      }
      
      smin = SsMin+(SsMax-SsMin)*K/100;
      smax = SsMax-(SsMax-SsMin)*K/100;
      val1[shift]=0;
      val2[shift]=0;
      
      if( Close[shift]<smin ) {
         uptrend = false;
      }
      if( Close[shift]>smax ) {
         uptrend = true;
      }
      
      if( uptrend != old  &&  uptrend == true ) {
         val1[shift]=Low[shift]-Range*0.5;
         Mainbuffer[shift]=val1[shift];
         if( Bars>alertBar && shift==0 && (CurTime() - PrevAlertTime > Period()*Alert_Delay_In_Seconds) ) {
         
         Alert("Trendsignal V2.0 ",Period(),""," Mins Timeframe",Symbol()," BUY @", Ask,"");alertBar = Bars;
if(Enablemail == true) {SendMail(subjectDown+" "+ Symbol(),textDown+" "+ Close[1]+" "+ Symbol()); }
            PrevAlertTime = CurTime();
         }
      }
      
      if( uptrend!=old && uptrend==false ) {
         
         val2[shift]=High[shift]+Range*0.5;
         Mainbuffer[shift]=val2[shift];
         if( Bars>alertBar && shift==0 && (CurTime() - PrevAlertTime > Period()*Alert_Delay_In_Seconds) ) {
         
         Alert("Trendsignal V2.0 ",Period(),"","Mins Timeframe ",Symbol()," SELL @", Bid,"");alertBar = Bars;
if(Enablemail == true) {SendMail(subjectUp +" "+ Symbol(),textUp+" "+ Close[1]+" " + Symbol());}
            PrevAlertTime = CurTime();
         }
      }
      
      Print(shift);
      old=uptrend;
   }
   
   return(0);
}
//+------------------------------------------------------------------+
 
Abubakar Saidu: please help me …
  1. Help you with what? You haven't stated a problem, you stated a want. You have only four choices:
    1. Search for it.
    2. Beg at
    3. MT4: Learn to code it.
      MT5: Learn to code. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
    4. or pay (Freelance) someone to code it.
    We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
              No free help
              urgent help.

  2. Etasoft forex generator, EA builder, EATree, Forex Strategy Builder, FOREXEADVISOR STRATEGY BUILDER, FX EA Builder, fxDreema, FxPro, Molanis, Online Forex Expert Advisor Generator, Quant, Strategy Builder FX, Visual Trader Studio, MQL5 Wizard, etc., are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned the language up front, and then just wrote it.
    • Since you haven't learned MQL4/5, therefor there is no common language for us to communicate.
      If we tell you what you need, you can't code it.
      If we give you the code, you don't know how to integrate it into yours.
      We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.

    • EA builder makes bad code counting up while closing multiple orders.
      EA builder makes bad code Bars is unreliable (Max bars in chart), volume is unreliable (miss ticks.) Always use time.
      EA builder makes bad code, not adjusting for 4/5 digit brokers, TP/SL and slippage.
      EA builder makes bad code, not adjusting for ECN brokers. (pre-Build 500)
      EA builder makes bad code, not checking return codes.
      EATree uses objects on chart to save values — not persistent storage ( files or GV+Flush.) No recovery (crash/power failure.)

    • FX EA Builder makes bad code, not checking return codes.
      FX EA Builder makes bad code, loosing open tickets on terminal restart. No recovery (crash/power failure.)
      FX EA Builder makes bad code, not adjusting stops for the spread.
      FX EA Builder makes bad code, using OrdersTotal directly.

    • FOREXEADVISOR STRATEGY BUILDER makes bad code, non-updateing global variables.
      FOREXEADVISOR STRATEGY BUILDER makes bad code, compilation errors.
      FOREXEADVISOR STRATEGY BUILDER makes bad code, not checking return codes.

    Learn to code it, or pay someone (Freelance) someone to code it.
 

Yes thanks a lot.. i used the above you gave me -3.  MT4: Learn to code it.

it helped me a lot..

Thanks again for your help.

 

Hello guys, I have a similar problem, I have created an EA that execute trades based on the appearing of BUY and SELL arrows. However the EA ignores some arrows, I don't know why? Any help? Also How do I close the trade when an opposte arrow appears? Thank you.


void OnTick()

{

   //indicator reading

   

   int total_orders = OrdersTotal();

   double FixedLot = AccountBalance() * 0.0001;

   FixedLot = NormalizeDouble(FixedLot, 2); // rounding lotsize to 2 decimal places

   int buy_ticket = 0;

   int sell_ticket = 0;

   

   double super_buy_arrow  = iCustom(NULL,0,"super-arrow-indicator",0,0);

   double super_sell_arrow = iCustom(NULL,0,"super-arrow-indicator",1,0);

  

   

   // Buy or Sell if Arrow appears

   if(total_orders == 0)

   {

      if(  super_buy_arrow != EMPTY_VALUE )

      {

           buy_ticket = OrderSend(Symbol(), OP_BUY, FixedLot, Ask, Slippage, Ask-StopLoss*_Point, Ask+TakeProfit*_Point,NULL, Magic, 0, Green); 

      }


      if(  super_sell_arrow != EMPTY_VALUE )

      {

           sell_ticket = OrderSend(Symbol(), OP_SELL, FixedLot, Bid, Slippage, Bid+StopLoss*_Point, Bid-TakeProfit*_Point,NULL, Magic, 0, Red);

      }

   }

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Requests to execute trade operations are formalized as orders. Each order has a variety of properties for reading. Information on them can be obtained using functions Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The...
 
gilash1234:

Hello guys, I have a similar problem, I have created an EA that execute trades based on the appearing of BUY and SELL arrows. However the EA ignores some arrows, I don't know why? Any help?

We cant see your codes

Reason: