Source: https://fxcodebase.com/code/viewtopic.php?f=31&t=63891
Forum: 31 · Topic 63891 · 24 post(s)
Apprentice · Fri Sep 23, 2016 4:38 am

Open Long Both time frames are in up trend Open Short Both time frames are in down trend
Optinal Exit If two time frames disagree.
If “Use Trend Filter” is off, second time frame filter will not be used. If “Only on subtrend change” is on, trade will be executed, only if we have a change in the indication on smaller time frame.
Two Line SuperTrend Strategy.lua
SuperTrend.lua is available here. viewtopic.php?f=17&t=3102&hilit=SUPERTREND
The Strategy was revised and updated on January 21, 2019.
colajam1979 · Fri Sep 23, 2016 5:55 am
Good morning, You sure are quick with your work. Thanks for this, i have it running in demo atm hoping it will work as expected
colajam1979 · Fri Sep 23, 2016 10:15 am
Hello Apprentice. I have run this in my demo account today and it works well enough for me but Can you modify it one more time so that a first position is opened sooner?
If the 5 minute is the trend line and is long when the 1 minute is short the short will not be opened - perfect.
if the 1 minute short continues changing the 5 minute trend to short can a short position be entered?
all other rules remain the same
see image below.
thanks again
Norm123 · Tue Oct 04, 2016 2:28 pm
Hi Apprentice,
Many thanks for your content on here. Some really great stuff. I have been testing the ‘two line supertrend’ with different parameters etc. Almost a really good strategy for what I want.
Is it possible to add a function so that providing the two lines are in same direction, if I am using Line 1 as the shorter time period ‘activating’ line and it closes on opposite, the strategy keeps opening a new trade at the next trigger point in the same direction?
At the moment, I am using Line 1 as the shorter ‘activation’ line and Line 2 as the longer term trend. The stategy is only activating a trade at the first trigger point but then not closing on opposite and not activating subsequent trades even when both lines are in same direction.
Thanks!
Norm123 · Sat Oct 08, 2016 4:09 am
Hi Apprentice,
Having playing and fiddled with the parameters etc I have got it working.
Is it possible to add a Bollinger band filter to this strategy? In a long, when the price crosses through the upper Bollinger band, the trade closes and in a short, when the price crosses the lower band the trade closes?
Dan
Apprentice · Wed Oct 12, 2016 5:26 am
Bug Fixed. Please Re-Download.
Apprentice · Wed Oct 12, 2016 5:56 am
At the moment, I am using Line 1 as the shorter ‘activation’ line and Line 2 as the longer term trend. The stategy is only activating a trade at the first trigger point but then not closing on opposite and not activating subsequent trades even when both lines are in same direction.
Set “Only on subtrend change” to no
JOKER83 · Sat Oct 29, 2016 6:06 pm
can you make close parameter to the bigger supertrend
Apprentice · Sun Dec 18, 2016 9:10 am
Strategy was revised and updated.
josediaz · Fri Jan 13, 2017 5:54 am
hi
i have installed your strategy, but there are not buy or sell
allow startegy to trade = true
thank you
regards
Apprentice · Sun Jan 15, 2017 5:13 am

Tested in the simulator. Can you tell me more about your testing method. FIFO / non FIFO, Live / Demo Simulator / Backtester, used settings…
albertparis · Thu Sep 21, 2017 10:46 am
beug
Hello
The maximum number of lots is 100
Apprentice · Fri Sep 29, 2017 7:34 am
Try it now.
albertparis · Sat Sep 30, 2017 9:36 am
Apprentice wrote: Try it now.
thank you for your work
Apprentice · Sat Dec 30, 2017 8:22 am
The strategy was revised and updated.
lucasyokko · Fri Feb 07, 2020 9:36 am
Hi Do you have Mt4 version for this strategy?
Apprentice · Mon Feb 10, 2020 6:28 am
Your request is added to the development list. Development reference 703.
Apprentice · Wed Feb 12, 2020 1:43 pm
Try this version. viewtopic.php?f=38&t=69405
tuhadfe · Thu Feb 27, 2025 12:05 pm
Hi this strategy has a bug it doesnt appear to sell just buy
tuhadfe · Tue Mar 04, 2025 5:13 am
Hi
This doesnt work for me, can the bug be fixed.
Can enter a trade if both trend filter and subtrend are in buy or sell but exit the trade if the subtrend changes in opposite direction.
eg Only enter a trade when both are in same direction and exit trade when either change.
Apprentice · Tue Mar 04, 2025 5:23 am
We have added your request to the development list. Development reference 146
tuhadfe · Wed Mar 05, 2025 7:51 pm
Hi is this a development request or just a bug fix?
It doesnt Sell if you select sell, also it doesnt appear to use the subtrend.
I would appreciate any help.
Thanks
Apprentice · Fri Mar 14, 2025 4:24 am

I have no problems. Keep in mind, each line will work on its own respective timeframe.
tuhadfe · Sat Mar 15, 2025 12:22 pm
Thanks I think its my confusion, I had installed a different version of the underlying supertrend, already installed prior and it was using this version. I didnt spot this…sorry my bad