Strategy based on PRC Supertrend Extended
Forums › ProRealTime English forum › General trading discussions › Strategy based on PRC Supertrend Extended
- This topic has 14 replies, 4 voices, and was last updated 1 month ago by SnorreDK.
-
-
09/17/2024 at 6:20 AM #23767109/17/2024 at 8:55 AM #237682
Hi!
Here you have an example from Nicolas indicator (https://www.prorealcode.com/prorealtime-indicators/supertrend-extended/)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869// --- settingsmultiplier=2.236period=66type=1 //1 = use ATR , 2 = Use standard deviation , 3 = Use standard errormidperiod=10// --- end of settingstype=max(1,type)if type=1 thenmoy=averagetruerange[period](close)elsif type=2 thenmoy=std[period](close)elsif type=3 thenmoy=ste[period](close)endifmyprice=(highest[midperiod](high)+lowest[midperiod](low))/2up=myprice+multiplier*moydn=myprice-multiplier*moyonce trend=1if close>up[1] thentrend=1elsif close<dn[1] thentrend=-1endifif trend<0 and trend[1]>0 thenflag=1elseflag=0endifif trend>0 and trend[1]<0 thenflagh=1elseflagh=0endifif trend>0 and dn<dn[1] thendn=dn[1]endifif trend<0 and up>up[1] thenup=up[1]endifif flag=1 thenup=myprice+multiplier*moyendifif flagh=1 thendn=myprice-multiplier*moyendifif trend=1 thenmysupertrend=dnoffset=moy//color1=0//color2=191//color3=255elsemysupertrend=upoffset=-moy//color1=255//color2=69//color3=0endifif trend=1 and trend[1]<>1 then//drawarrowup(barindex,mysupertrend) coloured(color1,color2,color3)buy 1 contract at marketendifif trend=-1 and trend[1]<>-1 then//drawarrowdown(barindex,mysupertrend) coloured(color1,color2,color3)sellshort 1 contract at marketendif1 user thanked author for this post.
09/17/2024 at 11:37 AM #237700I 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
09/17/2024 at 1:19 PM #23771010/10/2024 at 1:17 PM #23882510/11/2024 at 6:53 AM #238840The 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
10/11/2024 at 6:57 AM #23884210/11/2024 at 7:02 AM #23884310/11/2024 at 8:28 AM #23884810/11/2024 at 8:34 AM #23884910/11/2024 at 9:02 AM #23885010/11/2024 at 9:27 AM #23885610/11/2024 at 9:35 AM #23885710/11/2024 at 9:38 AM #238858Because 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 < noEntryAfterTimep=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 TP10/11/2024 at 9:46 AM #238859Code
Code12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970// Definition of code parametersDEFPARAM 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” timeDEFPARAM FLATAFTER = 155800// Prevents the system from creating new orders to enter the market or increase position size before the specified timenoEntryBeforeTime = 100000timeEnterBefore = time >= noEntryBeforeTime// Prevents the system from placing new orders to enter the market or increase position size after the specified timenoEntryAfterTime = 150000timeEnterAfter = time < noEntryAfterTimep=1Start=100000If Time=start thenLTC=0STC=0SRev=0LRev=0endifTimeframe (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=totalpriceTRND=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=totalpriceInd5=Supertrend[a,b]UE=iprice crosses over Ind5DE =iprice crosses under Ind5If UP and UP10 and UE and LTC<1 and SRev<1and Timeenterbefore and Timeenterafter AND not onmarket thenBuy p contract at marketLTC=LTC+1SL=LstpTP=LtgtEndif//if long stopped and short term trend down enter shortIF longonmarket[1] and not onmarket and strategyprofit<strategyprofit[1] and DWN and LRev<1 thensellshort p contracts at marketLRev=LRev+1Srev=Srev+1SL=sstpRTP=stgtREndifIf DWN and DWN10 and DE and STC<1 and LRev<1and Timeenterbefore and Timeenterafter and NOT onmarket thenSellshort p contract at marketSTC=STC+1SL=sstpTP=stgtEndif//if short stopped and short term tren up thenIf shortonmarket[1] and not onmarket and strategyprofit<strategyprofit[1] and UP and SRev<1 thenbuy p contracts at marketSRev=SRev+1Lrev=Lrev+1SL=lstpRTP=ltgtREndifset Stop PLoss SLSet target pprofit TP -
AuthorPosts
Find exclusive trading pro-tools on