Советники: ZigZag step market - страница 2

 

Hey Vladimir,


How would you prefer to receive code snips? Why do you or does anyone delete attachments?


The attachment signals.mq5 is the signaling function from the product in question.



Quoted here: Question: Is this working or were you intentions different, can you modify it?

//+------------------------------------------------------------------+
//| Search trading signals                                           |
//+------------------------------------------------------------------+
bool SearchTradingSignals(void)
  {
//--- ZigZag knee search
   double high[],low[];
   ArraySetAsSeries(high,true);
   ArraySetAsSeries(low,true);
   int start_pos=0,count=300;
   if(!iGetArray(handle_iCustom,0,start_pos,count,high) ||
      !iGetArray(handle_iCustom,1,start_pos,count,low))
     {
      return(false);
     }
   MqlRates rates[];
   ArraySetAsSeries(rates,true);
   start_pos=0;
   count=300;
   if(CopyRates(_Symbol,_Period,start_pos,count,rates)!=count)
      Print("Error getting rates");
   double left=0.0,right=0.0;
   for(int i=0; i<count; i++)
     {
      if(high[i]!=0.0 || low[i]!=0.0)
        {
         double value=(high[i]!=0.0)?high[i]:low[i];
         if(value==0.0)
            return(false);
         if(right==0.0)
           {
            right=value;
            continue;
           }
         if(left==0.0)
           {
            left=value;
            break;
           }
        }
     }
   if(left==0.0 || right==0.0)
      return(false);

   int count_buys = 0;
   double price_lowest_buy     = DBL_MIN;
   int count_sells= 0;
   double price_highest_sell   = DBL_MAX;

   CalculateAllPositions(count_buys,price_lowest_buy,
                         count_sells,price_highest_sell);
   if(InpReverse)
     {
      if(left<right)
         if(rates[1].low-price_lowest_buy>ExtStep)
           {
            int size_need_position=ArraySize(SNeedPosition);
            ArrayResize(SNeedPosition,size_need_position+1);
            SNeedPosition[size_need_position].pos_type=POSITION_TYPE_BUY;
            //---
            return(true);
           }
      if(left>right)
         if(price_highest_sell-rates[1].high>ExtStep)
           {
            int size_need_position=ArraySize(SNeedPosition);
            ArrayResize(SNeedPosition,size_need_position+1);
            SNeedPosition[size_need_position].pos_type=POSITION_TYPE_SELL;
            //---
            return(true);
           }
     }
   if(InpReverse)
     {
      if(left>right)
         if(rates[1].low-price_lowest_buy>ExtStep)
           {
            int size_need_position=ArraySize(SNeedPosition);
            ArrayResize(SNeedPosition,size_need_position+1);
            SNeedPosition[size_need_position].pos_type=POSITION_TYPE_BUY;
            //---
            return(true);
           }
      if(left<right)
         if(price_highest_sell-rates[1].high>ExtStep)
           {
            int size_need_position=ArraySize(SNeedPosition);
            ArrayResize(SNeedPosition,size_need_position+1);
            SNeedPosition[size_need_position].pos_type=POSITION_TYPE_SELL;
            //---
            return(true);
           }
     }
//---
   return(true);
  }


Have a nice day,


Oswald

 
Oswald O #:


Я до сих пор не понимаю - в чём Ваш вопрос? 

 
I am working on making your strategy profitable. Downloaded it buys high and sells low. This is the signaling function. It is very important for this to work. Can you fix it if it isn't?
 
Oswald O #:
I am working on making your strategy profitable. Downloaded it buys high and sells low. This is the signaling function. It is very important for this to work. Can you fix it if it isn't?

Вы умеете заглядывать в будущее?

Причина обращения: