pdrhParticipant
Average
Hi,
Has anyone coded a strategy based on the PRC Supertrend Extended and if so can you post it
Cheers
Hi!
Here you have an example from Nicolas indicator (https://www.prorealcode.com/prorealtime-indicators/supertrend-extended/)
// --- settings
multiplier=2.236
period=66
type=1 //1 = use ATR , 2 = Use standard deviation , 3 = Use standard error
midperiod=10
// --- end of settings
type=max(1,type)
if type=1 then
moy=averagetruerange[period](close)
elsif type=2 then
moy=std[period](close)
elsif type=3 then
moy=ste[period](close)
endif
myprice=(highest[midperiod](high)+lowest[midperiod](low))/2
up=myprice+multiplier*moy
dn=myprice-multiplier*moy
once trend=1
if close>up[1] then
trend=1
elsif close<dn[1] then
trend=-1
endif
if trend<0 and trend[1]>0 then
flag=1
else
flag=0
endif
if trend>0 and trend[1]<0 then
flagh=1
else
flagh=0
endif
if trend>0 and dn<dn[1] then
dn=dn[1]
endif
if trend<0 and up>up[1] then
up=up[1]
endif
if flag=1 then
up=myprice+multiplier*moy
endif
if flagh=1 then
dn=myprice-multiplier*moy
endif
if trend=1 then
mysupertrend=dn
offset=moy
//color1=0
//color2=191
//color3=255
else
mysupertrend=up
offset=-moy
//color1=255
//color2=69
//color3=0
endif
if trend=1 and trend[1]<>1 then
//drawarrowup(barindex,mysupertrend) coloured(color1,color2,color3)
buy 1 contract at market
endif
if trend=-1 and trend[1]<>-1 then
//drawarrowdown(barindex,mysupertrend) coloured(color1,color2,color3)
sellshort 1 contract at market
endif
pdrhParticipant
Average
I was hoping for something a little more robust
I have tried a strategy using Supertrend Extended on 2 timeframes to determine the trend and Nicolas’s U BOT Alerts to deternmine the entry
and this seems to be promising.
I would post the code but I cannot see the link
You can add the code as an .itf file using ‘select file’ same as adding a screenshot.
How have your strategies been performing out-of-sample (OOS) lately?
Would you mind sharing the code or the ITF file?
pdrhParticipant
Average
The last few weeks have not been as good . I have modified the code for which I posted the the detailed report butIneed to find a way to improve the results when the price is trading sideways on the 30 sec timeframe .
Any suggestions would be appreciated
Noone can help u if u not share the code
pdrhParticipant
Average
I have exported the itf file and selected it but for some reason it is not appearing
After getting to the stage shown in your screenshot, i.e. .itf already attached … all you should need to do is to click on ‘Submit’ at bottom of page.
Weird that the .itf is not posting … try again.
pdrhParticipant
Average
That is what I have done a number of times . I have selected both the itf file and screenshot but only the screenshot is uploading
why not just paste the code?
Did you export the .itf using Option 1 – ‘None, Code will be fully editable’ ?
Above is just a thought as to why the .itf may not be attaching??
pdrhParticipant
Average
Yes I exported with “none’
I am going to try rebooting my computer
pdrhParticipant
Average
Because then the code is not as easily read
// Definition of code parameters
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the “FLATBEFORE” time.
DEFPARAM FLATBEFORE = 100000
// Cancel all pending orders and close all positions at the “FLATAFTER” time
DEFPARAM FLATAFTER = 155800
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 100000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 150000
timeEnterAfter = time < noEntryAfterTime
p=1
Start=100000
If Time=start then
LTC=0
STC=0
SRev=0
LRev=0
endif
Timeframe (10minutes,updateonclose)
ignored, indicator1 = CALL “PRC_SuperTrend Extended”[2.236, 66, 1, 10]
indicator2, ignored = CALL “PRC_SuperTrend Extended”[2.236, 66, 1, 10]
iprice10=totalprice
TRND=ROC[2](iprice10)
UP10 = ((indicator1>indicator2)and TRND>0)
DWN10 =((indicator1<indicator2)and TRND<0)
Timeframe(default)
ignored, indicator3 = CALL “PRC_SuperTrend Extended”[2.236, 66, 1, 10]
indicator4, ignored = CALL “PRC_SuperTrend Extended”[2.236, 66, 1, 10]
UP = (indicator3 >= indicator4)
DWN =(indicator3 <= indicator4)
iprice=totalprice
Ind5=Supertrend[a,b]
UE=iprice crosses over Ind5
DE =iprice crosses under Ind5
If UP and UP10 and UE and LTC<1 and SRev<1and Timeenterbefore and Timeenterafter AND not onmarket then
Buy p contract at market
LTC=LTC+1
SL=Lstp
TP=Ltgt
Endif
//if long stopped and short term trend down enter short
IF longonmarket[1] and not onmarket and strategyprofit<strategyprofit[1] and DWN and LRev<1 then
sellshort p contracts at market
LRev=LRev+1
Srev=Srev+1
SL=sstpR
TP=stgtR
Endif
If DWN and DWN10 and DE and STC<1 and LRev<1and Timeenterbefore and Timeenterafter and NOT onmarket then
Sellshort p contract at market
STC=STC+1
SL=sstp
TP=stgt
Endif
//if short stopped and short term tren up then
If shortonmarket[1] and not onmarket and strategyprofit<strategyprofit[1] and UP and SRev<1 then
buy p contracts at market
SRev=SRev+1
Lrev=Lrev+1
SL=lstpR
TP=ltgtR
Endif
set Stop PLoss SL
Set target pprofit TP
Code
// Definition of code parameters
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the “FLATBEFORE” time.
DEFPARAM FLATBEFORE = 100000
// Cancel all pending orders and close all positions at the “FLATAFTER” time
DEFPARAM FLATAFTER = 155800
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 100000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 150000
timeEnterAfter = time < noEntryAfterTime
p=1
Start=100000
If Time=start then
LTC=0
STC=0
SRev=0
LRev=0
endif
Timeframe (10minutes,updateonclose)
ignored, indicator1 = CALL “PRC_SuperTrend Extended”[2.236, 66, 1, 10]
indicator2, ignored = CALL “PRC_SuperTrend Extended”[2.236, 66, 1, 10]
iprice10=totalprice
TRND=ROC[2](iprice10)
UP10 = ((indicator1>indicator2)and TRND>0)
DWN10 =((indicator1<indicator2)and TRND<0)
Timeframe(default)
ignored, indicator3 = CALL “PRC_SuperTrend Extended”[2.236, 66, 1, 10]
indicator4, ignored = CALL “PRC_SuperTrend Extended”[2.236, 66, 1, 10]
UP = (indicator3 >= indicator4)
DWN =(indicator3 <= indicator4)
iprice=totalprice
Ind5=Supertrend[a,b]
UE=iprice crosses over Ind5
DE =iprice crosses under Ind5
If UP and UP10 and UE and LTC<1 and SRev<1and Timeenterbefore and Timeenterafter AND not onmarket then
Buy p contract at market
LTC=LTC+1
SL=Lstp
TP=Ltgt
Endif
//if long stopped and short term trend down enter short
IF longonmarket[1] and not onmarket and strategyprofit<strategyprofit[1] and DWN and LRev<1 then
sellshort p contracts at market
LRev=LRev+1
Srev=Srev+1
SL=sstpR
TP=stgtR
Endif
If DWN and DWN10 and DE and STC<1 and LRev<1and Timeenterbefore and Timeenterafter and NOT onmarket then
Sellshort p contract at market
STC=STC+1
SL=sstp
TP=stgt
Endif
//if short stopped and short term tren up then
If shortonmarket[1] and not onmarket and strategyprofit<strategyprofit[1] and UP and SRev<1 then
buy p contracts at market
SRev=SRev+1
Lrev=Lrev+1
SL=lstpR
TP=ltgtR
Endif
set Stop PLoss SL
Set target pprofit TP