SuperTrend Mode
5 replies
eastpeace
2 years ago #271176
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
tomas262
2 years ago #271284
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
eastpeace
2 years ago #271286
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.
clonex / Ivan Hudec
2 years ago #271287
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
eastpeace
2 years ago #271007
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
It’s not original one. This is
EasyLanguage SuperTrend indicator – futures io
This mode is more adaptable to the market. It can describe muti time frame volatility in the only one single time frame.
clonex / Ivan Hudec
2 years ago #271010
Hi it is Big Mike’s implementation. I spent with that many hours trust me.
Viewing 5 replies - 1 through 5 (of 5 total)