Pivot Point Supertrend - MQL4 Code

Поділитися
Вставка
  • Опубліковано 23 сер 2024
  • This is a Metatrader implementation of the Pivot Point Supertrend indicator available on Tradingview.com. I plan to use this indicator in a coming video developing an expert.
    The Pivot Point Supertrend indicator is a variation on the Supertrend indicator that uses a weighted average of high and low pivot points (fractals).
    This video is for MQL4. I have a separate video for MQL5 that will be released soon and there will be a link to the MQL5 video below.
    MQL5 Version: • Pivot Point Supertrend...
    If you just want the indicator and not the code this link is to download the compiled version:
    ko-fi.com/s/86...
    To download the Metatrader 4 and 5 platforms and open demo accounts
    MT4: www.orchardfor...
    MT5: www.orchardfor...
    Web: www.orchardfor...
    Twitter: / orchardforex
    Telegram: t.me/orchardforex

КОМЕНТАРІ • 59

  • @OrchardForex
    @OrchardForex  2 роки тому +8

    I found a problem with the MT4 version that appears sometimes if I change symbol on a chart that has the indicator already loaded and results in some resistance or support lines disappearing up or down at the ends. To fix make 2 adjustments.
    In OnInit add the following lines after the SetIndexBuffer statements:
    SetIndexEmptyValue( 0, EMPTY_VALUE );
    SetIndexEmptyValue( 1, EMPTY_VALUE );
    and in OnTick add the following 2 lines just before the line "if ( BufferSupport[i + 1] != EMPTY_VALUE ) {"
    BufferResistance[i] = EMPTY_VALUE;
    BufferSupport[i] = EMPTY_VALUE;

    • @ipelengmekgwe834
      @ipelengmekgwe834 Рік тому

      I'm getting the error "array out of range" when setting ppLast (ppLast = BufferLast[i + 1]). I have tried to initialize the array with SetIndexEmptyValue(5, EMPTY_VALUE), but still no luck any ideas?

    • @OrchardForex
      @OrchardForex  Рік тому +1

      @@ipelengmekgwe834 Check this line above
      for ( int i = count - 1; i >= 0; i-- ) {

  • @mr.luckytrader007dg9
    @mr.luckytrader007dg9 2 роки тому +2

    Thanks again for free education!
    God bless you! 😊

  • @maxkelter3561
    @maxkelter3561 2 роки тому +2

    Seems like the strategy can be very good when you design your own indicator. Liked it on Trading View - so nice to have it for Mt4 platform. Tnx.

    • @OrchardForex
      @OrchardForex  2 роки тому +2

      Thank you, I might be making more like this in the future.

  • @donbangert
    @donbangert 2 роки тому

    Glad to see you created a stable Supertrend indicator. The one I found online seemed to repaint occasionally.

    • @OrchardForex
      @OrchardForex  2 роки тому

      This is not the original supertrend, this uses a weighted average high low. Original supertrend just uses moving average for the centre line. But the concepts are the same. Maybe see ua-cam.com/video/7Tr9zkclSuk/v-deo.html

  • @trustfultrading
    @trustfultrading 2 роки тому +3

    Cool video, im looking forward for the strategy. Maybe i will add this indicator to my EA. What I noticed is that when you use functions like "iATR" in your indicator, the final indicator value is usually delayed by one tick because the ATR has not yet been calculated for the current tick. This is not such a big problem if you have an EA that uses every tick, but if you only trade with opening prices of a new candle, then you should adjust your code accordingly to solve the problem. (Mql5)

    • @OrchardForex
      @OrchardForex  2 роки тому +1

      I haven't noticed that, sounds like a bug in MQL5. Maybe report it on their forum.

    • @trustfultrading
      @trustfultrading 2 роки тому +1

      I will write a test indicator to check this again. Keep up the great work.

  • @shahinsinv
    @shahinsinv 2 роки тому

    Many thanks for Supertrend indicator. Looking ahead , use this indicator by Expert. Once again Thanks a lot.

    • @OrchardForex
      @OrchardForex  2 роки тому

      Indicator coming in about 2 weeks, have to get through the MQL5 version first.

  • @MyMy-tv7fd
    @MyMy-tv7fd 2 роки тому

    at last! Many thanks for explanation of OnCalculate function

    • @OrchardForex
      @OrchardForex  2 роки тому

      That wasn't really my intent but I'm glad it helped. Actually it gives me a topic idea for another video. Thanks.

  • @jglazebrook8930
    @jglazebrook8930 2 роки тому

    Thank you very much!!! Appreciate your video!!! I liked it so much, that I tried to use your MTF video, without much success. Thank you again!!!

    • @jglazebrook8930
      @jglazebrook8930 2 роки тому

      Thank you again. I have continued to try to put the longer TF on lower TFs, without success. Are you able to create a video on how to create an MTF version of this, please?

    • @OrchardForex
      @OrchardForex  2 роки тому +1

      Sorry about the MTF. Longer timeframes can get complex. I suggest just load 2 charts.

    • @jglazebrook8930
      @jglazebrook8930 2 роки тому

      @@OrchardForex Yes will do, or as I am using the higher TF for trend, add an OBJ_VLINE at the higher TF change in trend.

  • @viniciocoelho3538
    @viniciocoelho3538 Рік тому

    Super mega excellent🎉🎉🎉🎉🎉🎉

  • @DiyaPatel99
    @DiyaPatel99 2 роки тому

    Thanks 🙏🙏🙏🙏🙏

  • @alekseyfirsin1839
    @alekseyfirsin1839 2 роки тому

    Thanks a lot :)) I was looking a good supertrend ind for a long time. The version that I found and used before was a bit heavy for testing in expert and now I coded it myself with your help :) many thanks for that. But one issue appeard there are some places were lines were drawn with anomalies. I can't attach the picture to show the problem. Can I contact with you somehow to show the problem?

    • @OrchardForex
      @OrchardForex  2 роки тому

      anomalies are probably random points where the support or resistance line dives down to zero or off to infinity. That is normally caused by elements of the array containing a value that is not recognised as EMPTY_VALUE. Try adding SetIndexEmptyValue(bufferNumber, 0).

  • @bhogendranathnath5553
    @bhogendranathnath5553 Рік тому

    thank you. kindly share code for this

  • @markusskalnins5156
    @markusskalnins5156 4 місяці тому

    will there be an ea made?

  • @jafxtradinginstitute6395
    @jafxtradinginstitute6395 2 роки тому

    Could use JBR trend indicator or QQE indicator as filter also.
    To spot trend reversals and Divergence

    • @OrchardForex
      @OrchardForex  2 роки тому

      Well this is just the indicator. If you know of a published strategy leave a link and if it looks like hvaing enough interest I can try it.

  • @Snakebite2k
    @Snakebite2k 2 роки тому

    Hi, this is exactly what I was looking for. Do you happen to have the Supertrend Indicator on Tradingview's list? That would be great if you could replicate it too.
    Great job keep it up.

    • @OrchardForex
      @OrchardForex  2 роки тому

      Supertrend indicator is readily available. Search mql5.com

  • @James_Answers_Everything
    @James_Answers_Everything Рік тому

    Mine does not draw support or resistance lines. not sure what I missed. 0 errors found in compile and it does draw the mid. Thanks

    • @OrchardForex
      @OrchardForex  Рік тому +1

      Experts don't draw their underlying indicators. You have to load the indicator separately onto the chart

    • @James_Answers_Everything
      @James_Answers_Everything Рік тому

      @Orchard Forex I see, thank you for the reply and the videos.

    • @James_Answers_Everything
      @James_Answers_Everything Рік тому

      @Orchard Forex oh wait, this is just the indicator where I'm having trouble. I haven't tried coding the EA yet until I get this indicator working

    • @OrchardForex
      @OrchardForex  Рік тому

      @@James_Answers_Everything I don't know. I've just loaded the file and tried the indicator (from the same download) Using the default settings on EURUSD various timeframes I get all 3 lines. Check the experts and journals tabs to see if any errors are reported. Open the data window to see if it shows value lines for resistance, Support and Mid. One of resistance / support should always have a value but not both. Check the indicator colors tab to make sure the other 2 lines aren't set to none or the background colour.

    • @James_Answers_Everything
      @James_Answers_Everything Рік тому

      @Orchard Forex yeah the compiled download works great. I just wanted to follow along to get the source code mq4 so I could try making it an ea. Great idea tho, I didn't think to look at the data window to make sure it's seeing values.

  • @kingalbertois
    @kingalbertois 2 роки тому

    🙏🙏🙏thank u sir is there a video for super trend EA coding lesson on any video if not please I'm requesting one please 🙏 n thank you

    • @OrchardForex
      @OrchardForex  2 роки тому +3

      It's coming

    • @kingalbertois
      @kingalbertois 2 роки тому

      @@OrchardForex please make it from super trend that have 4 buffer or 5 buffers if possible please 🙏 or the super trend that is made from bollerbands please

    • @claytonmascall1548
      @claytonmascall1548 2 роки тому

      @@OrchardForex Very well put together video. I as well would be interested in the SuperTrend indicator coding as well as the SuperTrend EA coding because I used this video as a reference to create a simple SuperTrend indicator but it just doesn't seems like the lines are showing on MT4. I wanna create a TripleSuperTrend Indicator using (period 12 atr 3.0), (period 11 atr 2.0) & (period 10 atr 1.0). Looking forward to your video soon

  • @OSWALD569
    @OSWALD569 2 роки тому

    indicaotor_type4-6 give false inputs in color tab.

    • @OrchardForex
      @OrchardForex  2 роки тому

      I hadn't noticed that but you are correct. Color inputs are shown for the 3 hidden buffers but it has no material impact on the indicator, even if you change the values the lines don't show and it doesn't impact the calculated results.
      Actually it is possible to write this indicator completely without the 3 additional buffers but for anyone following and comparing I wanted to keep the code structure close to the Tradingview version.

  • @jafxtradinginstitute6395
    @jafxtradinginstitute6395 2 роки тому

    Need a Supply and Demand zones indicator. That is stable

    • @OrchardForex
      @OrchardForex  2 роки тому

      It's not on my list but I'll look into it.

  • @Democraps_are_narrow-minded
    @Democraps_are_narrow-minded 2 роки тому

    I wonder can this method make money?

    • @OrchardForex
      @OrchardForex  2 роки тому

      This is just an indicator, so on it's own, no.

  • @mixai7
    @mixai7 2 роки тому +1

    is it mt4 version?

    • @OrchardForex
      @OrchardForex  2 роки тому +1

      It’s in the title

    • @mixai7
      @mixai7 2 роки тому

      @@OrchardForex I follow your codes, there are some variation with trading view values,Support line and resistance line values EURUSD 1HR and 30MIN also not same with tradingview.

    • @OrchardForex
      @OrchardForex  2 роки тому +1

      @@mixai7 Check that you have the same prices on both feeds. The results shown are affected by the high and low of each bar. I can also see small differences but the calculations are correct and the differences are due to a different price. Mid points are affected by the high or low at the recent pivot and every point is affected by the ATR which depends on high low and close prices.

  • @jimharkins4487
    @jimharkins4487 2 роки тому

    I'm a new subscriber, and new to MQL4, long time software developer though. I'm trying to follow your code testing values along the way. Line 99 sets ppLast to 32bit int max (2147483647.0). All of the buffers seem to have this same behaviour. Is there something I'm missing or is this normal? Thanks!

    • @OrchardForex
      @OrchardForex  2 роки тому

      That should be true in the early stages before any pivot points are found. Once there is a pivot point pplast will keep picking up the most recent value. Buffer elements are naturally initialised to EMPTY_VALUE and that led to a small problem that I noted after the video was released. See the comment pinned at the top of the comment list.
      The code is written like this to match the Tradngview script but it is possible to remove the 3 working buffers completely using a different technique, but I didn't think there would be any value showing it.

    • @jimharkins4487
      @jimharkins4487 2 роки тому

      Nevermind, it's the EMPTY_VALUE