fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Indicator buffer values

    Questions & Answers
    2
    3
    1276
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      zerrow last edited by

      Hi, I use indicator from My indicators. The indicators test shows two out put buffers. Indicator values are double: 0 and 1. In condition block I use indicator value 0 and on the right side value == 0. I put ea on testing and add indicator with the same values as EA. Indicator works as I should, bet ea probably didnt pick up this value from indicator. Anu help please.

      1 Reply Last reply Reply Quote 0
      • Z
        zerrow last edited by

        We have just two output buffers I need:

        double up[], dn[]

        and condition 1:
        if ( dn[1] != 0 ) and
        condition 2 :
        if ( up[1] != 0 )
        In condition block:
        left side: My indicators/my indicator/Indicator mode (buffer) value 0:Downpinbar
        right side: != Value/numeric/=0

        EA doesnt pick up indicator values.

        The code is pretty simple :

        
        #property copyright "smjones"
        #property link      ""
        
        #property indicator_chart_window
        #property indicator_buffers 3
        #property indicator_color1 Red
        #property indicator_color2 Aqua
        #property indicator_color3 White
        #property indicator_width1 1
        #property indicator_width2 1
        #property indicator_width3 1
        
        extern bool       AlertOn = true;
        extern int        Offset = 10;
        extern double     PBRatio = 0.8;
        //extern double     PBTail  = 0.25;
        //extern int        TailBarsBack = 2;
        extern double     Entry = 0.50;
        
        datetime          alertonce = 0; 
         double            up[], dn[], ExtMapBuffer1[];
        int               mult = 1;
        //+------------------------------------------------------------------+
        //| Custom indicator initialization function                         |
        //+------------------------------------------------------------------+
        int init()
          {
        //---- indicators
              if (Digits == 3 || Digits == 5)
                 mult = 10;
              
              SetIndexBuffer(0,dn);
              SetIndexStyle(0,DRAW_ARROW);
              SetIndexArrow(0, 234);
              SetIndexLabel(0,"Down PinBar");
              SetIndexBuffer(1,up);
              SetIndexStyle(1,DRAW_ARROW);
              SetIndexArrow(1, 233);
              SetIndexLabel(1,"UP PinBAR");
              SetIndexStyle(2,DRAW_ARROW);
              SetIndexArrow(2,119);
              SetIndexBuffer(2,ExtMapBuffer1);
              SetIndexLabel(2,"EntryPoint"+DoubleToStr(Entry*100,2)+"%");      
        //----
           return(0);
          }
        //+----------------------------------------------------------------+
        //| Custom indicator deinitialization function                       |
        //+------------------------------------------------------------------+
        int deinit()
          {
        //----
           Comment("");
        //----
           return(0);
          }
        //+------------------------------------------------------------------+
        //| Custom indicator iteration function                              |
        //+------------------------------------------------------------------+
        int start()
          {
              double range,pb,tail;
              int limit;
              int counted_bars=IndicatorCounted();
              //---- last counted bar will be recounted
              if(counted_bars>0) counted_bars--;
              limit=Bars-counted_bars;
           
              for(int i=0; i<limit; i++)   
                 {
                    up&#91;i&#93; = 0;
                    dn&#91;i&#93; = 0;
                    ExtMapBuffer1&#91;i&#93; = 0;
                 }       
                 
           
              for( i=0; i<limit; i++)   
                 {
                    range = High&#91;i+1&#93;-Low&#91;i+1&#93;;
                    pb = range * PBRatio;
                    //tail = range * PBTail;
                    
                    
                    if ( Open&#91;i+1&#93; >= High&#91;i+1&#93;-pb && Close&#91;i+1&#93; >= High&#91;i+1&#93;-pb) // && Low&#91;i+2&#93; > Low&#91;i+1&#93;+tail && Low&#91;i+1&#93; < Low&#91;iLowest(NULL,0,MODE_LOW,TailBarsBack,i+2)&#93; )
                       {
                          up&#91;i+1&#93; = Low&#91;i+1&#93; - Offset*Point*mult;
                          ExtMapBuffer1&#91;i+1&#93; = High&#91;i+1&#93;-((High&#91;i+1&#93; - Low&#91;i+1&#93;) * Entry);
                          
                       }
                       
                    if ( Open&#91;i+1&#93; <= High&#91;i+1&#93;-(range-pb) && Close&#91;i+1&#93; <= High&#91;i+1&#93;-(range-pb)) // && High&#91;i+2&#93; < High&#91;i+1&#93;-tail && High&#91;i+1&#93; > High&#91;iHighest(NULL,0,MODE_HIGH,TailBarsBack,i+2)&#93; )
                       {
                          
                          dn&#91;i+1&#93; = High&#91;i+1&#93; + Offset*Point*mult;
                          ExtMapBuffer1&#91;i+1&#93; = ((High&#91;i+1&#93; - Low&#91;i+1&#93;) * Entry) + Low&#91;i+1&#93;;
                       }      
                 }
           
           if ( AlertOn && alertonce!= Time&#91;0&#93; )
              {
                 if ( dn&#91;1&#93; != 0 )
                    {
                       Alert(Symbol(), "  M",Period(),"  Sell Pin Bar @ ", DoubleToStr((High&#91;1&#93;-Low&#91;1&#93;)*Entry+Low&#91;1&#93;,Digits), "  ", TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS) );
                       alertonce = Time&#91;0&#93;;
                    } 
                 if ( up&#91;1&#93; != 0 )
                    {
                       Alert(Symbol(), "  M",Period(),"  Buy Pin Bar @ ", DoubleToStr(High&#91;1&#93;-((High&#91;1&#93;-Low&#91;1&#93;)*Entry),Digits), "  ", TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS) );
                       alertonce = Time&#91;0&#93;;
                    }
              }                  
                
        //----
           
        //----
           return(0);
          }
        //+------------------------------------------------------------------+
        
        
        1 Reply Last reply Reply Quote 0
        • M
          miro1360 last edited by

          try block Trace for your buffers in indicator tester and you will see buffers behavior with values 🙂

          Between trading and gambling is a very small gap, be careful.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          Online Users

          J
          2
          C
          R
          Q
          N
          E
          S

          15
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors