fxDreema

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

    Help with code? Miro?

    Questions & Answers
    2
    6
    1899
    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.
    • D
      danerius last edited by

      Hi

      If someone could help me with code for this it would be great. Ive included the code that Miro helped me with earlier.

      The concept is that this indicator is going to adjust to price fluctuations and in turn control other indicators.

      The idea is to:

      1. Divide High Price by Low Price -> (HL)
      2. Have the numbers from 1 (HL) with a set of different moving averages. All adjustable -> (HLMA)
      3. Divide that by an adjustable number. Take that to an adjustable PowerTo -> XXX/((HLMA)^XXX)
      4. Plot in separate window

      If anything is unclear. Please feel free to ask

      Many, many thanks /danerius

      //---

      int i;

      for(i=barsToCalculate();i>=0;i--)
      {
      double priceHigh = iHigh(Symbol(), Period(), i);
      double priceLow = iLow(Symbol(), Period(), i);
      double lowHigh;

        if(priceHigh != 0) 
        { 
           lowHigh = priceLow / priceHigh;
           Buffer0[i] = MathPow(lowHigh, 100);
        }
        else
        {
           Buffer0[i] = 0;
        }
      

      }

      for(i=barsToCalculate2();i>=0;i--)
      {
      Buffer1[i] = iMAOnArray(Buffer0, 0, maPeriod, 0, (ENUM_MA_METHOD)maMode, i);
      }

      //--- return value of prev_calculated for next call
      return(rates_total);
      }
      //+------------------------------------------------------------------+

      1 Reply Last reply Reply Quote 0
      • M
        miro1360 last edited by miro1360

        0_1529870748734_miro1360_test_1.2.mq4

        maybe there can be error 😄 try few excel calculations or something similiar for compare results to find potentially bug 😄

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

        1 Reply Last reply Reply Quote 0
        • D
          danerius last edited by danerius

          Hello Miro and many thanks 🙂

          I think there might be an error. Ive pre-tested this idea on XAGUSD in Excel and it behaves differently. Ive included a screendump where the values are ”200 / HighLowValue ^ 3500.

          Theses numbers are gonna vary between FX Pairs and Time Frames. But this could be a good start

          I can send you the Excel fille if it helps?

          Best regards /danerius

          0_1529962645542_XAGUSD-HLC.png

          1 Reply Last reply Reply Quote 0
          • M
            miro1360 last edited by

            this is what we have:

            0_1529967904541_c49e3cff-ca0d-47c0-a532-2f3d076f1ef8-image.png

            now calculation in details:

            0_1529968055284_0a287951-abca-4e35-8f11-8ffa48038d37-image.png

            0_1529968156656_e30aee0a-dcbc-415c-9fe0-f49422c07342-image.png

            0_1529968414982_c8f31d97-0af0-4fa2-9af2-ffdfe101628d-image.png

            so check, if there is not some error in provided formula, or if there is not something missing 😄

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

            1 Reply Last reply Reply Quote 0
            • D
              danerius last edited by

              Hello Miro

              Awesome 🙂 I'll look into the math ASAP

              Best regards /danerius

              1 Reply Last reply Reply Quote 0
              • D
                danerius last edited by

                Hi

                A little update...

                For some reason it worked fine on the second try without me modding anything. Not sure why. Might be that I adjusted the parameters in a different order. Or just Metatrader acting up

                Best regards /Bo

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

                Online Users

                E
                F
                A
                M
                E
                T
                S
                A
                M
                M
                E

                34
                Online

                146.6k
                Users

                22.4k
                Topics

                122.6k
                Posts

                Powered by NodeBB Forums | Contributors