Need help... anyone

 

Hi.

I`m new to this forum and I don`t know anything about programming. I have demotraded with the help of this indicator for several months now and I wonder if there is possible to make a EA out of this.

The criteria is as follows:

1. When the green "Gator lips" indicator crosses the red "Gator Teeth" indicator it`s an alert signal. When the green indicator crosses the blue "Gator Jaws" indicator and reaches a 2 pip lower value than the blue it is a sell order at current price.

2. When the green indicator crosses the red indicator and reaches a 2 pip higher value than the red indicator it is a close order at current price.

Same principal when the trend is upwards, but with opposite values.

When the green crosses the red on the way up it`s an alert, and a buy order when the green reaches a value that is 2 pip above the blue indicator. When the green indicator crosses the red indicator and reaches a 2 pip lower value it`s a close order.

As you can see at the chart it would have done a buy order and a close order at mark nr 3 and it would be a none profitable order, but it wouldn`t lost to many pips either.

Hope anyone can help

Best regards

RB

Norway

 

I am not sure but similar EA was described by Igor Morozov in his book about forex

//+------------------------------------------------------------------+
//|                                               Gator-crossing.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "https://www.metaquotes.net/"
 
extern int ExtCrossMeasure=5;
 
double UpperDiff, LowerDiff;
double GreenLine1, RedLine1, BlueLine1;
double GreenLine0, RedLine0, BlueLine0;
double GreenLineMinus1, RedLineMinus1, BlueLineMinus1;
double GreenLineMinus2, RedLineMinus2, BlueLineMinus2;
double GreenDiff1, GreenDiff2, GreenDiff3;
double BlueDiff1, BlueDiff2, BlueDiff3;
bool   IsCrossed=false;
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   static datetime PrevTime=0;
   int i;
//---- 
   if(PrevTime!=Time[0])
     {
      UpperDiff = iGator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_UPPER, 1);
      LowerDiff = -iGator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_LOWER, 1);
 
      GreenLine1=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORLIPS, 1);
      RedLine1=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORTEETH, 1);
      BlueLine1=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, 1);
 
      GreenLine0=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORLIPS, 0);
      RedLine0=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORTEETH, 0);
      BlueLine0=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, 0);
 
      GreenLineMinus1=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORLIPS, -1);
      RedLineMinus1=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORTEETH, -1);
      BlueLineMinus1=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, -1);
 
      GreenLineMinus2=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORLIPS, -2);
      RedLineMinus2=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORTEETH, -2);
      BlueLineMinus2=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, -2);
 
      GreenDiff1=GreenLine0-RedLine0;
      GreenDiff2=GreenLineMinus1-RedLineMinus1;
      GreenDiff3=GreenLineMinus2-RedLineMinus2;
 
      BlueDiff1=BlueLine0-RedLine0;
      BlueDiff2=BlueLineMinus1-RedLineMinus1;
      BlueDiff3=BlueLineMinus2-RedLineMinus2;
      PrevTime=Time[0];
     }
 
   if(OrdersTotal()>0)
     {
      //--- проверяем условие выхода
      if(GreenLineMinus1<RedLineMinus1 && GreenLine0>=RedLine0 && GreenLine1>RedLine1)
        {
         for(i=OrdersTotal()-1; i>=0; i--)
           {
           //---- оставшиеся длинные позиции по этому же инструменту нужно закрыть
           OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
           if(OrderSymbol()==Symbol() && OrderType()==OP_BUY)
             {
              OrderClose(OrderTicket(),OrderLots(),Bid,3);
             }
          }
        }
      if(GreenLineMinus1>RedLineMinus1 && GreenLine0<=RedLine0 && GreenLine1<RedLine1)
        {
         for(i=OrdersTotal()-1; i>=0; i--)
           {
            //---- оставшиеся короткие позиции по этому же инструменту нужно закрыть
            OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
            if(OrderSymbol()==Symbol() && OrderType()==OP_SELL)
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,3);
              }
           }
        }
     }
 
   if(UpperDiff>ExtCrossMeasure*Point || LowerDiff>ExtCrossMeasure*Point)
     {
      IsCrossed=false;
      return(0);
     }
 
   if(MathAbs(GreenLine1-BlueLine1)>ExtCrossMeasure*Point)
     {
      IsCrossed=false;
      return(0);
     }
//---- факт пересечения уже был определен
   if(IsCrossed) return(0);
   IsCrossed=false;
 
   if(GreenDiff3>=GreenDiff2 && GreenDiff2>=GreenDiff1 && GreenDiff1>=0 &&
      BlueDiff3<=BlueDiff2 && BlueDiff2<=BlueDiff1 && BlueDiff1<=0)
        {
          IsCrossed=true;
         OrderSend(Symbol(),OP_BUY,1.0,Ask,3,0.0,0.0);
        }
 
   if(GreenDiff3<=GreenDiff2 && GreenDiff2<=GreenDiff1 && GreenDiff1<=0 &&
      BlueDiff3>=BlueDiff2 && BlueDiff2>=BlueDiff1 && BlueDiff1>=0)
        {
          IsCrossed=true;
         OrderSend(Symbol(),OP_SELL,1.0,Bid,3,0.0,0.0);
        }
//----
   return(0);
  }
//+------------------------------------------------------------------+
Reason: