Not logged in
Viewing 4 posts - 1 through 4 (of 4 total)
  • #270088 |
    Customer
    268 Posts

    It’s nice to see that the SuperTrend has been built into b131.

    But the strange thing is that it has a MODE parameter, and it doesn’t seem to be of much use now.

    We know that there are two versions of the ST indicator. https://roadmap.strategyquant.com/tasks/sqp_0099

    Another,

    // TRLength = 9, ATRMult = 1,Strength = 9,  we can let Strength = ATRLength for simplicity.

    hl = Highest(High, ATRLength) – Lowest(Low, ATRLength);
    ATR = XAverage(hl, ATRLength);
    avg = (XAverage(high, Strength) + XAverage(low, Strength))/2;
    up = avg + ATRMult*ATR;
    dn = avg – ATRMult*ATR;

     

    //—–Multicharts function code —-

    inputs:
    STMode(numericsimple), ATReriod(numericsimple), ATRMultiplication(numericsimple);

    vars:
    ATR(0),
    avg(0),
    up(0),
    dn(0),
    ST(0);

    if STMode = 1 then begin   //real atr mode
    ATR = SQ_ATR(ATReriod)[0];
    avg = (high[0] + low[0])/2;
    end
    else if STMode = 0 then begin  //highest high and lowest low  range  as atr
    value1 = highest(h,ATReriod) – lowest(l,ATReriod);
    ATR = XAverage(value1,ATReriod);
    avg = (XAverage(high,ATReriod) + XAverage(low,ATReriod))/2;
    end;

    up = avg + ATR*ATRMultiplication;
    dn = avg – ATR*ATRMultiplication;

    if close[0] > ST[1] and close[1] <= ST[1] then ST=dn

    else if close[0] < ST[1] and close[1] >= ST[1] then ST=up

    else if ST[1] < dn then ST=dn

    else if ST[1] > up then ST=up

    else ST= ST[1] ;

    SQ_ST2=ST;

     

    //—-end—

     

    The function in MC script like this, you can freely choose the version you like, but I don’t know how to implement it in SQ. I am a bit confused about data types or indicator nesting. Can someone help me make one snippets? Many thanks

     

     

     

     

    #270134
    tomas262
    Administrator
    1823 Posts

    Hello,

    this parameter tells the code the way how to calculate the ATR value. It can be either

    ATR = SQ_ATR(ATReriod)[0];
    avg = (high[0] + low[0])/2;

    or

    value1 = highest(h,ATReriod) – lowest(l,ATReriod);
    ATR = XAverage(value1,ATReriod);
    avg = (XAverage(high,ATReriod) + XAverage(low,ATReriod))/2;

    based on the mode setting. Now SQ uses the default mode = 1 (real ATR) only. We could add some new modes into SQ in future

     

     

    #270136
    Customer
    268 Posts

    Thanks, tomas262,

    This is the same as I guessed.

    However, I have checked the code in SQ and MC, and there is only true ATR mode now.

    Hope SQX 132 dev1 will implement it.

    #270151
    Customer
    256 Posts

    HI Eastspace,

     

    The current version of Supetrend in the SQX is the “true” and original idea of Supetrend.  MODE  parameter is here because this is a way to add another mode without ” pain” to implement in the future. I found many of them. CCI, HMA versions, etc.

     

    hl = Highest(High, ATRLength) – Lowest(Low, ATRLength);
    ATR = XAverage(hl, ATRLength);
    avg = (XAverage(high, Strength) + XAverage(low, Strength))/2;
    up = avg + ATRMult*ATR;
    dn = avg – ATRMult*ATR;

     

    This version is originally from futures.io from admin big mike. Yes, it is possible that ill add it in the future but it is not a big priority for now.

     

    Clonex

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.