MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Source code library - Expert Advisors, Indicators and Scripts

The Largest Collection of Forex Robots is on Display in MQL 5 Code Base
To post a new code, please log in or register

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2010.11.29 14:32
Kolier_SuperTrend_Indi

Kolier_SuperTrend_Indi - indicator for MetaTrader 4

| English Spanish Portuguese Russian

Views:
11592
Rating:

Author:

Kolier.Li

Description:

SuperTrend.mq4 was created by Jason Robinson (jnrtrading) and published on http://www.forex-tsd.com/221493-post1.html

Logic of SuperTrend.mq4: http://kolier.li/indicator/how-supertrend-mq4-works-logic-of-supertrend-indicator-created-by-jason-robinson-jnrtradin

What's Kolier_SuperTrend_Indi

    • Same logic, improvement implementation in code, can draw full chart and less resource consume.
    • Extended. TrendMode=0 means original logic for trend line. TrendMode=1 means new logic for trend line.

    Image:

    TrendMode=0




    TrendMode=1


    Parameters

    • BarsToCount How many bars to draw trend line.
    • TrendMode TrendMode=0 means original logic for trend line. TrendMode=1 means new logic for trend line.
    • ATR_Period ATR Period settings.
    • ATR_Multiplier In order to calculate upper and lower bands with ATR Range = Multiplier * ATR.


    Issues and Update

    Project Page: http://kolier.li/project/kolier-supertrend-indi
    Last comments | Go to discussion (5)
    whroeder1
    whroeder1 | 1 Dec 2010 at 19:22
       int limit = Bars - bars_counted;
       ...
       for(int i=limit; i>=0; i--) {
          atr = iATR(Symbol(), 0, ATR_Period, i);
             ...
             buffer_line_up[i] = (High[i+1]+Low[i+1])/2;
    
    When bars_counted == 0, accesses High[Bar+1], High[Bar] and buffer[Bar] which do not exist. Also iATR is undefined for i=Bars-ATR_Period and above
    Oluwadare Paul Oguntosin
    forexgoshen | 28 May 2011 at 14:25

    Hello Kolier,

    can you please code an EA that will be working as Kolier_SuperTrend_Indi on 4hr time frame.

    The EA will open a buy oder when the green line is appear and close the oder when red line appear. And the open sell oder immediately red line appear and close it when green line appear.

    Hope to hear from you .

    Thanks

    mighty6469
    mighty6469 | 5 Jan 2013 at 22:16
    WHRoeder:
       int limit = Bars - bars_counted;
       ...
       for(int i=limit; i>=0; i--) {
          atr = iATR(Symbol(), 0, ATR_Period, i);
             ...
             buffer_line_up[i] = (High[i+1]+Low[i+1])/2;
    
    When bars_counted == 0, accesses High[Bar+1], High[Bar] and buffer[Bar] which do not exist. Also iATR is undefined for i=Bars-ATR_Period and above
    good observation, but to what purpose? The indicator wprks fine a shown, that's all one needs to use it!
    mighty6469
    mighty6469 | 5 Jan 2013 at 22:19
    gbemitte:

    Hello Kolier,

    can you please code an EA that will be working as Kolier_SuperTrend_Indi on 4hr time frame.

    The EA will open a buy oder when the green line is appear and close the oder when red line appear. And the open sell oder immediately red line appear and close it when green line appear.

    Hope to hear from you .

    Thanks


    imho, this is a great piece of work. I would use it with , for example, a moving average, for entry with entry and exit.  Use a strategy tester to see for yourself how useful it may be.
    MQL4 Comments
    mql4_comments | 19 Jun 2013 at 13:50

    This indicator stops drawing line on live prices in Trend Mode 1.