April 7, 2019 at 7:14 pm #52463Mandeep
- Topics: 45
- Replies: 22
- Posts: 67
I’ve been trying to code the Supertrend indicator (similar to WVS()) but havent been able to complete this. This is my code so far:
varup1 = ((high()+low()) / 2) + 3*atr();
varup2 = ((high(OFFSET=1)+low(OFFSET=1)) / 2) + 3*atr();
vardown1 = ((high()+low()) / 2) – 3*atr();
vardown2 = ((high(OFFSET=1)+low(OFFSET=1)) / 2) – 3*atr();
finalup = if((varup1 < varup2) AND close(OFFSET=1) < (I’m getting stuck from here)
plot1 = var1;
plot2 = var2;
The Original Rules
BASIC UPPERBAND = (HIGH + LOW) / 2 + Multiplier* ATR
BASIC LOWERBAND = (HIGH + LOW) / 2 – Multiplier* ATR
FINAL UPPERBAND = IF ((Current BASIC UPPERBAND< Previous FINAL UPPERBAND) and (Previous close < Previous FINAL LOWERBAND)) THEN (Current BASIC LOWERBAND) ELSE Previous FINAL LOWERBAND)
FINAL LOWERBAND = IF( (current BASIC LOWERBAND > Previous FINAL LOWERBAND) and (Previous Close < Previous FINAL LOWERBAND) ) THEN (Current BASIC LOWERBAND ) ELSE Previous FINAL LOWERBAND )
SUPERTREND = IF (Current Close <= Current FINAL UPPERBAND) THEN current FINAL UPPERBAND ELSE Current FINAL LOWERBAND
any help would be appreciated. I’m stuck on the Final Upper/Lowe Bands.
MandeepApril 9, 2019 at 11:23 am #52555Matthew
- Topics: 5
- Replies: 521
- Posts: 526
This tool uses two recursives within a single function which is not compatible with our scripting language at this time. To achieve this in Optuma you would need to code it in the Pascal based custom tool programming module.May 31, 2019 at 4:25 pm #53331Thomas
- Topics: 114
- Replies: 152
- Posts: 266
I want give you some suggestions about some alternatives for your SuperTrend Indicator that are already available as tools/indicators in Optuma.
The closest match to your SuperTrend Indictor is the “Wilder Volatility Stop” indicator.
The second one is the “ATR Trailing Stop” indicator but with this indicator you have to do the switch between up and down trend manually.
The third alternative is the “Fixed Days High Stop” and Fixed Days Low Stop”. But as with the “ATR Trailing Stop” indicator you have to do the switch between up and down trend manually.
Hope this is of help for you.May 11, 2020 at 8:49 pm #58021Mathew
- Topics: 40
- Replies: 2,010
- Posts: 2,050
I’ve had a look at the scripting and it is a little hard – we’ll see if we can add it into Optuma 1.6
1 user thanked author for this post.June 18, 2020 at 1:25 am #58621Darren
- Topics: 69
- Replies: 738
- Posts: 807
Just to let you know that the SuperTrend tool will be available in 1.6. You will also be able to create script formulas for scans, such as close crossing the SuperTrend ie change in trend. Look out for update news in the next couple of weeks!
- This reply was modified 1 year ago by Darren.
- You must be logged in to reply to this topic.