fxDreema

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

    Need help with order opening when my indicator draws arrows!

    Questions & Answers
    4
    10
    5313
    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.
    • O
      Oluwaseyifunmi last edited by

      PLS i have an indicator that also shows arrow, which of this signs would i use so as to tell the EA to pick the trade when the arrow shows, ==, >=, <=, !=.

      1 Reply Last reply Reply Quote 0
      • P
        PayBack last edited by

        Hello!

        I have indicator that draws up and down arrows (blue/red) on chart when i need to open order. I wand to made an EA on its base. EA must open orders when arrows are drawn.
        Here is link on my wrong EA.

        https://fxdreema.com/shared/9idWYi2Jb

        Some additional information:

        1. When indicator is dropped on chart, he draws arrows on history. I want to EA do not use old arrows, but only those who ware draws after next tick (new arrows).
        2. Arrows are redrawing inside one candle, on next candle arrow freezes. I need EA to open order only on first time arrow is drawn (once per candle; first time drawn).

        Here screenshot of indicator working - http://savepic.net/5370997.htm

        Help me please to build working EA!
        Thanks!

        1 Reply Last reply Reply Quote 0
        • fxDreema
          fxDreema last edited by

          I just replied to very similar question: viewtopic.php?f=2&t=2464

          There is no need to work with objects if the indicator has working buffers, so check those buffers first. If buffers does not give you any meaningful information (because not all custom indicators do), then the objects can be used.

          Otherwise in your project you are checking for Arrow Down and Arrow Up, but the arrows on the chart are not exactly this type. Here are all arrow codes listed: http://docs.mql4.com/constants/objectco ... /wingdings You can check that code with Condition, but better check if you have working buffers out there 🙂

          And use "Once per bar" after (not before) the block who detects when the arrow is there to make the logic to detect only the first appearance of the arrow.

          1 Reply Last reply Reply Quote 0
          • P
            PayBack last edited by

            Thanks for answer!

            My indicator has 8 buffers (0;1;2;3;4;5;6;7) - 8xStochastics with different values.
            There is no buffer for those arrows, they are drawing when all 8 buffers (Stochastic oscillator lines) are crossing a level line.

            May be there is another way to catch those object on chart by color checking.
            For example: for each object ---> check color ---> if blue then open buy, if red then sell. I have tried that way but nothing exist...

            Additional inf. - http://savepic.net/5365660.jpg

            Thanks!

            1 Reply Last reply Reply Quote 0
            • fxDreema
              fxDreema last edited by

              This is for a new block like "Object Appear", but there are so many objects and parameters... sometimes it's easier to just write some simple code like this:

              static string name0;
              int total=ObjectsTotal();
              for (int i=total-1; i>=0; i--)
              {
                 string name=ObjectName(i);
                 if (name==name0) {break;}
                 if (ObjectType(name)==OBJ_ARROW && ObjectGet(name, OBJPROP_ARROWCODE)==236)
                 {
                    if (ObjectGet(name, OBJPROP_COLOR)==Blue)
                    {
                       name0=name;
                       ~next~
                       break;
                    }
                    else if (ObjectGet(name, OBJPROP_COLOR)==Red)
                    {
                       name0=name;
                       ~inext~
                       break;
                    }
                 }
              }
              

              Try this in a custom block (https://fxdreema.com/studio/MQL4). I didn't tested it, but I guess it will work.. or it will need some simple fix. I hope you will get what is the idea, I think you have some MQL4 basics 🙂
              Keyword ~next~ will be replaced with function calls for the next blocks for the orange output, and ~inext~ also, but for the yellow output.

              1 Reply Last reply Reply Quote 0
              • P
                PayBack last edited by

                Hello again!
                Shame on me, i have not been able to deal with this code you wrote to me.
                Separately i understand it and how to use blocks in fxDreema. But i can not to connect this code to fxDreema blocks.
                And if you have the opportunity, please help me to add the custom block with custom code based on my indicator - "SpundsStochastic" to my project.
                Only what i want to my EA detects new symbols - Arrows, by type(number, for example 236) or by color.
                Here is the picture how it must to work - http://savepic.net/5384677.jpg
                And below is code of my indicator.
                Thanks allot if would help me again! 😏

                //+------------------------------------------------------------------+
                //|                                              SpudsStochastic.mq4 |
                //|                               Copyright © 2012, Vladimir Hlystov |
                //+------------------------------------------------------------------+
                #property copyright "Copyright © 2012, Vladimir Hlystov"
                #property link      "cmillion@narod.ru"
                //+------------------------------------------------------------------+
                extern bool AlertON     = false;
                extern bool DrawARROW   = true;
                extern int  LevelUp     = 85;
                extern int  LevelDn     = 15;
                //+------------------------------------------------------------------+
                /*8 стохастических осцилляторов. 
                Параметры «замедление» и «период %D» оставляем по умолчанию – 3. 
                Параметр %K будет меняться от 6 до 24. 
                Таким образом, мы имеем 8 стохастиков с параметрами (6, 3, 3), 
                (7, 3, 3), (8, 3, 3) … (24, 3, 3). 
                У всех индикаторов используется только главная линия, а сигнальную мы 
                отключаем. */
                //+------------------------------------------------------------------+
                #property indicator_separate_window
                #property indicator_minimum 0
                #property indicator_maximum 100
                #property indicator_level1	15
                #property indicator_level2	85
                #property indicator_levelcolor	Silver
                #property indicator_levelwidth	0
                #property indicator_levelstyle	2
                #property indicator_buffers 8
                #property indicator_color1 Blue
                #property indicator_style1 2
                #property indicator_width1 1
                #property indicator_color2 Blue
                #property indicator_style2 2
                #property indicator_width2 1
                #property indicator_color3 Blue
                #property indicator_style3 2
                #property indicator_width3 1
                
                #property indicator_color4 Yellow
                #property indicator_style4 2
                #property indicator_width4 2
                
                #property indicator_color5 Red
                #property indicator_style5 2
                #property indicator_width5 1
                #property indicator_color6 Red
                #property indicator_style6 2
                #property indicator_width6 1
                #property indicator_color7 Red
                #property indicator_style7 2
                #property indicator_width7 1
                #property indicator_color8 Red
                #property indicator_style8 2
                #property indicator_width8 1
                //---- buffers
                double BUFFER_1[];
                double BUFFER_2[];
                double BUFFER_3[];
                double BUFFER_4[];
                double BUFFER_5[];
                double BUFFER_6[];
                double BUFFER_7[];
                double BUFFER_8[];
                int Signal;
                //+------------------------------------------------------------------+
                int init()
                  {
                //---- indicator lines
                   SetIndexStyle(0,DRAW_LINE);
                   SetIndexBuffer(0,BUFFER_1);
                   SetIndexStyle(1,DRAW_LINE);
                   SetIndexBuffer(1,BUFFER_2);
                   SetIndexStyle(2,DRAW_LINE);
                   SetIndexBuffer(2,BUFFER_3);
                   SetIndexStyle(3,DRAW_LINE);
                   SetIndexBuffer(3,BUFFER_4);
                   SetIndexStyle(4,DRAW_LINE);
                   SetIndexBuffer(4,BUFFER_5);
                   SetIndexStyle(5,DRAW_LINE);
                   SetIndexBuffer(5,BUFFER_6);
                   SetIndexStyle(6,DRAW_LINE);
                   SetIndexBuffer(6,BUFFER_7);
                   SetIndexStyle(7,DRAW_LINE);
                   SetIndexBuffer(7,BUFFER_8);
                //---- name for DataWindow and indicator subwindow label
                   SetIndexLabel(0,"(6, 3, 3)");
                   SetIndexLabel(1,"(9, 3, 3)");
                   SetIndexLabel(2,"(12, 3, 3)");
                   SetIndexLabel(3,"(14, 3, 3)");
                   SetIndexLabel(4,"(16, 3, 3)");
                   SetIndexLabel(5,"(19, 3, 3)");
                   SetIndexLabel(6,"(21, 3, 3)");
                   SetIndexLabel(7,"(24, 3, 3)");
                   string Name="Spuds Stochastic";
                   IndicatorShortName(Name);
                   ObjectCreate("SpudsStochastic_on",OBJ_LABEL,WindowFind(Name),0,0);// Создание объ.
                   ObjectSet("SpudsStochastic_on",OBJPROP_CORNER,0);
                   ObjectSet("SpudsStochastic_on",OBJPROP_XDISTANCE,5);
                   ObjectSet("SpudsStochastic_on",OBJPROP_YDISTANCE,15);
                   if(AlertON)ObjectSetText("SpudsStochastic_on","Alert ON",8,"Arial",Blue);
                   else ObjectSetText("SpudsStochastic_on","Alert OFF",8,"Arial",Red);
                   return(0);
                  }
                //+------------------------------------------------------------------+
                int start()
                  {
                   int counted_bars=IndicatorCounted();
                   if(counted_bars<0) return(-1);
                   if(counted_bars>0) counted_bars--;
                   int limit=Bars-counted_bars;
                   if(counted_bars==0) limit-=1+1;
                
                   string name;
                   for(int i=limit; i>=0; i--)
                     {
                      BUFFER_1*  = iStochastic(NULL,0,6,3,3,MODE_SMA,0,MODE_MAIN,i);
                      BUFFER_2*  = iStochastic(NULL,0,9,3,3,MODE_SMA,0,MODE_MAIN,i);
                      BUFFER_3*  = iStochastic(NULL,0,12,3,3,MODE_SMA,0,MODE_MAIN,i);
                      BUFFER_4*  = iStochastic(NULL,0,14,3,3,MODE_SMA,0,MODE_MAIN,i);
                      BUFFER_5*  = iStochastic(NULL,0,16,3,3,MODE_SMA,0,MODE_MAIN,i);
                      BUFFER_6*  = iStochastic(NULL,0,19,3,3,MODE_SMA,0,MODE_MAIN,i);
                      BUFFER_7*  = iStochastic(NULL,0,21,3,3,MODE_SMA,0,MODE_MAIN,i);
                      BUFFER_8*  = iStochastic(NULL,0,24,3,3,MODE_SMA,0,MODE_MAIN,i);
                
                      if((BUFFER_1*>LevelUp && BUFFER_2*>LevelUp && BUFFER_3*>LevelUp && BUFFER_4*>LevelUp && BUFFER_5*>LevelUp && BUFFER_6*>LevelUp && BUFFER_7*>LevelUp && BUFFER_8*>LevelUp) || 
                         (BUFFER_1*<LevelDn && BUFFER_2*<LevelDn && BUFFER_3*<LevelDn && BUFFER_4*<LevelDn && BUFFER_5*<LevelDn && BUFFER_6*<LevelDn && BUFFER_7*<LevelDn && BUFFER_8*<LevelDn))
                        {
                         Signal=0;
                        }
                
                      if((BUFFER_1*>LevelDn && BUFFER_2*>LevelDn && BUFFER_3*>LevelDn && BUFFER_4*>LevelDn && BUFFER_5*>LevelDn && BUFFER_6*>LevelDn && BUFFER_7*>LevelDn && BUFFER_8*>LevelDn) && 
                         (BUFFER_1*<LevelDn || BUFFER_2*<LevelDn || BUFFER_3*<LevelDn || BUFFER_4*<LevelDn || BUFFER_5*<LevelDn || BUFFER_6*<LevelDn || BUFFER_7*<LevelDn || BUFFER_8*<LevelDn))
                        {
                         if(DrawARROW && Signal==0)
                           {
                            name=StringConcatenate("SpudsStochastic_",TimeToStr(Time*,TIME_DATE|TIME_MINUTES));
                            ObjectDelete(name);
                            ObjectCreate(name,OBJ_ARROW,0,Time*,Low*,0,0,0,0);
                            ObjectSet(name,OBJPROP_ARROWCODE,236);
                            ObjectSet(name,OBJPROP_COLOR,Blue);
                            Signal=1;
                           }
                         if(AlertON && i<2) Alert(Symbol()+" Spuds Stochastic Buy");
                        }
                
                      if((BUFFER_1*<LevelUp && BUFFER_2*<LevelUp && BUFFER_3*<LevelUp && BUFFER_4*<LevelUp && BUFFER_5*<LevelUp && BUFFER_6*<LevelUp && BUFFER_7*<LevelUp && BUFFER_8*<LevelUp) && 
                         (BUFFER_1*>LevelUp || BUFFER_2*>LevelUp || BUFFER_3*>LevelUp || BUFFER_4*>LevelUp || BUFFER_5*>LevelUp || BUFFER_6*>LevelUp || BUFFER_7*>LevelUp || BUFFER_8*>LevelUp))
                        {
                         if(DrawARROW && Signal==0)
                           {
                            name=StringConcatenate("SpudsStochastic_",TimeToStr(Time*,TIME_DATE|TIME_MINUTES));
                            ObjectDelete(name);
                            ObjectCreate(name,OBJ_ARROW,0,Time*,High*,0,0,0,0);
                            ObjectSet(name,OBJPROP_ARROWCODE,238);
                            ObjectSet(name,OBJPROP_COLOR,Red);
                            Signal=-1;
                           }
                         if(AlertON && i<2) Alert(Symbol()+" Spuds Stochastic Sell");
                        }
                
                     }
                   return(0);
                  }
                //+------------------------------------------------------------------+
                int deinit()
                  {
                   remove_objects("SpudsStochastic_");
                  }
                //+------------------------------------------------------------------+
                int remove_objects(string PreName)
                  {
                   for(int k=ObjectsTotal()-1; k>=0; k--)
                     {
                      string Obj_Name=ObjectName(k);
                      string Head=StringSubstr(Obj_Name,0,StringLen(PreName));
                
                      if(Head==PreName)
                        {
                         ObjectDelete(Obj_Name);
                        }
                     }
                   return(0);
                  }
                //--------------------------------------------------------------------+
                
                
                1 Reply Last reply Reply Quote 0
                • fxDreema
                  fxDreema last edited by

                  The code I posted above was to be used as a custom block via https://fxdreema.com/studio/MQL4, not within "Custom MQL4 code". The "Custom MQL4 code" does the code that is written inside and it passes always, so it's not suitable to make a condition. While in the studio (https://fxdreema.com/studio/MQL4) the keywords ~next~ and ~inext~ connects the block with the next blocks... I already wrote that above. Just try it 🙂

                  1 Reply Last reply Reply Quote 0
                  • P
                    PayBack last edited by

                    Oh, thanks allot!!! 😄 I just have problems with English knowledge, and have not understand all correctly, sorry for that!
                    I made a custom block, started testing in MT4, but still have some problems 😞 . Now he can`t to find the symbols - http://savepic.net/5389600.jpg

                    1 Reply Last reply Reply Quote 0
                    • fxDreema
                      fxDreema last edited by

                      The real symbol name looks to be EURUSD.e

                      1 Reply Last reply Reply Quote 0
                      • l'andorrà
                        l'andorrà last edited by

                        Could you please open a new thread instead of retaking this old one? Additionally, sharing the indicator would help.

                        (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

                        (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

                        (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

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

                        Online Users

                        C
                        A
                        X
                        J

                        14
                        Online

                        146.7k
                        Users

                        22.4k
                        Topics

                        122.6k
                        Posts

                        Powered by NodeBB Forums | Contributors