Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

First independent community of traders

First independent community of traders Logo First independent community of traders Logo

First independent community of traders Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • Buy Theme
  • Home
  • About Us
  • Blog
  • Contact Us
Home/ Questions/Q 4759
Next
In Process
vitaliy9999999
vitaliy9999999

vitaliy9999999

  • 4 Questions
  • 4 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
vitaliy9999999
Asked: December 27, 20202020-12-27T05:30:56+00:00 2020-12-27T05:30:56+00:00In: Forex Expert Advisors

Help me describe a piece of code. I want to tie the Fibonacci levels to the zigzag.

  • 0

Help me describe a piece of code. I want to tie the Fibonacci levels to the zigzag. The logic is simple, on the correction we enter into sales or purchases. We also look at the last movement of the zigzag. The problem is in the description of the zigzag extremes. The zigzag extreme is formed no more than once every five candles, and in my code everything is somehow crooked! 

I ask for help in General who is not difficult to help!

here’s the code:   for(int i=5;i<=20;i++)
     {
     if(Low1>lowM15[i]){Low1=lowM15[i];}
     if(highM15[i]-Low1>(highM15[1]-Low1)*0.12){indLow1=i;break;}
     }
     for(int i=indLow1;i<=indLow1+40;i++)
     {
     if(High2     if((High2-Low1)*0.12     }
     }
     if((High2-Low1)*0.39
The pictures show the entry conditions.

  • 5 5 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    5 Answers

    • Voted
    • Oldest
    • Recent
    1. ich_hub

      ich_hub

      • 0 Questions
      • 1 Answer
      • 0 Best Answers
      • 22 Points
      View Profile
      ich_hub
      2020-12-27T05:31:26+00:00Added an answer on December 27, 2020 at 5:31 am

      I once solved a similar problem for ZigZag:

      I think this will help You.

      Good luck.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. mvs

      mvs

      • 0 Questions
      • 49 Answers
      • 0 Best Answers
      • 136 Points
      View Profile
      mvs
      2020-12-27T05:31:17+00:00Added an answer on December 27, 2020 at 5:31 am

      Aleksey Vyazmikin:

      Now I’m just working with ZZ, I made a function for vertices.

      If you can, please comment on what this code does and how to use it?

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    3. -aleks-

      -aleks-

      • 2 Questions
      • 35 Answers
      • 0 Best Answers
      • 72 Points
      View Profile
      -aleks-
      2020-12-27T05:31:13+00:00Added an answer on December 27, 2020 at 5:31 am

      Now I’m just working with ZZ, I made a function for vertices.

      input int ExtDepth=48;
      input int ExtDeviation= 5;
      input int ExtBackstep = 3;

      int handle_ZZ=0;
      double ZigZagVizual []; / / zig-zag visualization
      double ZigZagHighs []; / / upper zig-zag fractures
      double ZigZagLows []; / / lower zig-zag fractures

      double ZZ_High_Price[]; //Maximum price of a segment
      datetime ZZ_High_Time[]; //Time of formation of the maximum price of the vertex
      double ZZ_Low_Price []; //Minimum price of the segment
      datetime ZZ_Low_Time[]; //Time of formation of the minimum price of the vertex
      double ZZ_Start_Price[]; //Initial price of the segment
      datetime ZZ_Start_Time[]; //Start time of the segment
      double ZZ_Stop_Price[]; //Final (current for the last) price of the segment
      datetime ZZ_Stop_Time[]; //End time of the segment
      int ZZ_Vektor[]; //The direction vector of the line segment

      int OnInit()
      {
      handle_ZZ=iCustom(Symbol(),PERIOD_CURRENT,"ExamplesZigZag_",ExtDepth,ExtDeviation,ExtBackstep);
      if(handle_ZZ==INVALID_HANDLE)
      {
      PrintFormat("Failed to create handle of the handle_ZZ indicator for the symbol %s/%s, error code %d",
      Symbol(),EnumToString(Period()),GetLastError());
      return(INIT_FAILED);
      }

      return(INIT_SUCCEEDED);
      }

      void OnTick()
      {
      ZZ();

      Print ("ZZ_Start_Price=",ZZ_Start_Price[0]," ZZ_Stop_Price=",ZZ_Stop_Price[0]);
      Print ("ZZ_Start_Time=",ZZ_Start_Time[0]," ZZ_Stop_Time="+ZZ_Stop_Time[0]);
      }

      void ZZ()
      {
         ArrayFree(ZigZagHighs);
         ArrayFree(ZigZagLows);
         ArrayFree(ZigZagVizual);

      //      Copy the upper and lower zig-zag fractures to the buffers:
         int BarTotal=Bars(Symbol(),PERIOD_CURRENT);
         CopyBuffer(handle_ZZ,1,0,BarTotal,ZigZagHighs);
         CopyBuffer(handle_ZZ,2,0,BarTotal,ZigZagLows);
      //      Copy the visualization of zig-zag fractures to the buffers:
         CopyBuffer(handle_ZZ,0,0,BarTotal,ZigZagVizual);

      // Increase the buffer size to the number of bars
      int arrSize=MathMax(ArraySize(ZigZagHighs),ArraySize(ZigZagLows));
         ArrayFree(ZZ_High_Price);
         ArrayFree(ZZ_High_Time);
         ArrayFree(ZZ_Low_Price);
         ArrayFree(ZZ_Low_Time);
         ArrayResize(ZZ_High_Price,arrSize);
         ArrayResize(ZZ_High_Time,arrSize);
         ArrayResize(ZZ_Low_Price,arrSize);
         ArrayResize(ZZ_Low_Time,arrSize);

      //--Remove the spaces between ZZ
      int a=0;
         int B=0;

         double ZZ_High=0.0;
         double ZZ_Low=0.0;

         for(int i=arrSize-1; i>0; i--)
           {
            ZZ_High=ZigZagHighs[i];
            ZZ_Low=ZigZagLows[i];
            if(ZZ_High>0 && ZigZagVizual[i]>0)
              {
               ZZ_High_Price[A]=ZZ_High;
               ZZ_High_Time[A]=iTime(Symbol(),PERIOD_CURRENT,BarTotal-i-1);
               A++;
              }
            if(ZZ_Low>0 && ZigZagVizual[i]>0)
              {
               ZZ_Low_Price[B]=ZZ_Low;
               ZZ_Low_Time[B]=iTime(Symbol(),PERIOD_CURRENT,BarTotal-i-1);
               B++;
              }
           }

      //--Find out the maximum number of segments
      int arrSizeOtrezok=MathMax(A*2, B*2) +1;

         ArrayFree(ZZ_Start_Price);
         ArrayFree(ZZ_Start_Time);
         ArrayFree(ZZ_Stop_Price);
         ArrayFree(ZZ_Stop_Time);
         ArrayResize(ZZ_Start_Price,arrSizeOtrezok);
         ArrayResize(ZZ_Start_Time,arrSizeOtrezok);
         ArrayResize(ZZ_Stop_Price,arrSizeOtrezok);
         ArrayResize(ZZ_Stop_Time,arrSizeOtrezok);

         ArrayFree(ZZ_Vektor);
         ArrayResize(ZZ_Vektor,arrSizeOtrezok);

         int VektorLast=0; //--Vector of the last segment

      / / --Define the vector of the last segment
      if(ZZ_High_Time[0]>ZZ_Low_Time[>0]) VektorLast=1;
         if(ZZ_High_Time[0]0]) VektorLast=-1;
         Print(VektorLast);

         bool Chetniy=false;
         double ChetniyN=0;

         for(int i=0; i1; i++)
           {
            Chetniy=true;
            ChetniyN=i;
            if(i>0 && NormalizeDouble(ChetniyN/2,0)-ChetniyN/2>0)Chetniy=false;
            if(VektorLast==1)
            {
            if(Chetniy==false)//2
                 {
                  int N=(i-1)/2;
                  ZZ_Start_Price[i-1]=ZZ_Low_Price[N];
                  ZZ_Start_Time[i-1]=ZZ_Low_Time[N];
                  ZZ_Stop_Price[i-1]=ZZ_High_Price[N];
                  ZZ_Stop_Time[i-1]=ZZ_High_Time[N];
                  ZZ_Vektor[i-1]=1;
          
                  ZZ_Start_Price[i]=ZZ_High_Price[N+1];
                  ZZ_Start_Time[i]=ZZ_High_Time[N+1];
                  ZZ_Stop_Price[i]=ZZ_Low_Price[N];
                  ZZ_Stop_Time[i]=ZZ_Low_Time[N];
                  ZZ_Vektor[i]=-1;
                  }
             }    
            if(VektorLast==-1)
            {
            if(Chetniy==false)//2
                 {
                  int N=(i-1)/2;
                  ZZ_Start_Price[i-1]=ZZ_High_Price[N];
                  ZZ_Start_Time[i-1]=ZZ_High_Time[N];
                  ZZ_Stop_Price[i-1]=ZZ_Low_Price[N];
                  ZZ_Stop_Time[i-1]=ZZ_Low_Time[N];
                  ZZ_Vektor[i-1]=-1;
          
                  ZZ_Start_Price[i]=ZZ_Low_Price[N+1];
                  ZZ_Start_Time[i]=ZZ_Low_Time[N+1];
                  ZZ_Stop_Price[i]=ZZ_High_Price[N];
                  ZZ_Stop_Time[i]=ZZ_High_Time[N];
                  ZZ_Vektor[i]=1;
                  }
             }        
           }

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    4. vitaliy9999999

      vitaliy9999999

      • 4 Questions
      • 4 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      vitaliy9999999
      2020-12-27T05:31:05+00:00Added an answer on December 27, 2020 at 5:31 am

      Vladimir Karputov:

      1. Insert the code correctly, not as a sheet of text.

      2. Always use the stylist in the editor – you will immediately see your mistakes:

      As soon as the code is correct, you can continue to fill it.

      I agree about the parenthesis. I just tore a piece of code out of the body of the program… I have difficulty in calculating extremmov zigzag that would impose on them levels. the zigzag indicator sets the number of candles in which the indicator cannot draw two vertices. I basically calculated the movement at 12 percent, but how to set the number of candles? 

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    5. barabashkakvn

      barabashkakvn

      • 7 Questions
      • 162 Answers
      • 0 Best Answers
      • 314 Points
      View Profile
      barabashkakvn
      2020-12-27T05:31:00+00:00Added an answer on December 27, 2020 at 5:31 am

      vitaliy9999999:

      Help me describe a piece of code. I want to tie the Fibonacci levels to the zigzag. The logic is simple, on the correction we enter into sales or purchases. We also look at the last movement of the zigzag. The problem is in the description of the zigzag extremes. The zigzag extreme is formed no more than once every five candles, and in my code everything is somehow crooked! 

      I ask for help in General who is not difficult to help!

      here’s the code:   for(int i=5;i<=20;i++)

           {

           if(Low1>lowM15[i]){Low1=lowM15[i];}

           if(highM15[i]-Low1>(highM15[1]-Low1)*0.12){indLow1=i;break;}

           }

           for(int i=indLow1;i<=indLow1+40;i++)

           {

           if(High2

           if((High2-Low1)*0.12

           }

           }

           if((High2-Low1)*0.39

      The pictures show the entry conditions.

      1. Insert the code correctly, not as a sheet of text.

      2. Always use the stylist in the editor – you will immediately see your mistakes:

         for(int i=5;i<=20;i++)
           {
            if(Low1>lowM15[i])
              {
               Low1=lowM15[i];
              }
            if(highM15[i]-Low1>(highM15[1]-Low1)*0.12)
              {
               indLow1=i;break;
              }
           }
         for(int i=indLow1;i<=indLow1+40;i++)
           {
            if(High2if((High2-Low1)*0.12break;
              }
           }
        }

      if((High2-Low1)*0.391]-Low1)
        {
         Sell=true;
        }

      As soon as the code is correct, you can continue to fill it.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    Stats

    • Questions 504
    • Answers 2k
    • Posts 5
    • Comments 0
    • Best Answers 0
    • Users 681
    • Popular
    • Comments
    • Tags
    • forexcommunity

      Highlighting what’s important about questions & Answers on Discy Community!

      • 0 Comments
    • forexcommunity

      Introducing Keyboard Shortcuts, our first Labs feature

      • 0 Comments
    • forexcommunity

      Defining quality on Discy Engine — what a helpful answer ...

      • 0 Comments
    • forexcommunity

      Organizational and company accounts on Discy Engine the next step

      • 0 Comments
    • forexcommunity

      Hello world!

      • 0 Comments

    Related Questions

    • Brus Agell

      Правельный выбор

      • 0 Answers
    • pinupcasinoo

      Pin Up Casino

      • 0 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 2 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 0 Answers
    • c00l777

      Optimization results differ on different accounts

      • 3 Answers

    Users

    Leonardcig

    Leonardcig

    • 0 Questions
    • 0 Answers
    DennisByday

    DennisByday

    • 0 Questions
    • 0 Answers
    Haroldmeary

    Haroldmeary

    • 0 Questions
    • 0 Answers

    Footer

    First independent community of traders

    About

    An independent community of forex traders. This is where traders communicate. You can ask your questions and you will receive an answer to your question.
    • Terms of Use
    • Privacy Policy
    • Cookie Policy
    • Knowledge Base
    • Support

    © 2021 Forexcommunity.net. All Rights Reserved