prohibit trades when > supertrend
Forums › ProRealTime English forum › ProOrder support › prohibit trades when > supertrend
- This topic has 11 replies, 3 voices, and was last updated 5 years ago by
Vonasi.
-
-
12/06/2020 at 5:06 AM #152698"prohibit1234567891011121314151617181920212223242526272829303132333435363738394041supertrend" >DEFPARAM CUMULATEORDERS = falseDEFPARAM PRELOADBARS = 200//bearbear = supertrend < close [12.28]bear2 = supertrend < close [3.10]////////////////////////////////////bullbull = supertrend < close [30.210]a = High[0] - Low[0]b = Min(Open[0], Close[0]) - Low[0]c = b/ad = c*2//abcd = condition// Conditions to enter long positions//IF NOT LongOnMarket AND a and b and c and d THEN//BUY 1 CONTRACTS AT MARKET//ENDIF// Conditions to exit long positions//If LongOnMarket AND YourConditions THEN//SELL AT MARKET//ENDIF// Conditions to enter short positionsIF NOT ShortOnMarket AND bear and bear2 and d THENSELLSHORT 1 CONTRACTS AT MARKETENDIF// Conditions to exit short positionsIF ShortOnMarket AND bull THENEXITSHORT AT MARKETENDIF// Stops and targets : Enter your protection stops and profit targets hereSET STOP PTRAILING 82SET TARGET PROFIT 18212/06/2020 at 10:21 AM #15270712/06/2020 at 10:24 AM #15271012/06/2020 at 10:37 AM #152714
I think those brackets are intended for SUPERTREND, but:
- they must be put next to ST
- a comma must be used to separate the two numbers, instead of a period.
Line 1 is a bit messy.
Have you had any chance to read documentation about SuperTrend?
1 user thanked author for this post.
12/06/2020 at 11:03 AM #152720Sorry about line 1, please disregard that mistake, first time uplaoding to the Forum
was also trying to streamline the supertrend as apposed to being
indicator1 = SuperTrend[3,10]
c1 = (close > indicator1)maybe that’s why the system is not acknowledging it
12/06/2020 at 11:32 AM #1527241234567891011121314151617181920212223242526272829303132333435363738394041424344DEFPARAM CUMULATEORDERS = falseDEFPARAM PRELOADBARS = 200//bearbear = supertrend[12,28]c1 = (close < bear)bear2 = supertrend[3,10]c2 = (close < bear2)////////////////////////////////////bull//bull = supertrend[30,210]//c3 = (close < bull)a = High[0] - Low[0]b = Min(Open[0], Close[0]) - Low[0]c = b/ad = c*2//abcd = condition// Conditions to enter long positions//IF NOT LongOnMarket AND a and b and c and d THEN//BUY 1 CONTRACTS AT MARKET//ENDIF// Conditions to exit long positions//If LongOnMarket AND YourConditions THEN//SELL AT MARKET//ENDIF// Conditions to enter short positionsIF NOT ShortOnMarket AND c1 and c2 and d THENSELLSHORT 1 CONTRACTS AT MARKETENDIF// Conditions to exit short positions//IF ShortOnMarket AND c3 THEN//EXITSHORT AT MARKET//ENDIF// Stops and targets : Enter your protection stops and profit targets hereSET STOP PTRAILING 82SET TARGET PROFIT 18212/06/2020 at 11:40 AM #152725Hi,
Tided up some lo0se ends on that with advice taken onboard, thanks.
Also added another condition
bear3 = supertrend[36,211]
c3 = (close < bear3)seems much better,
Still would like to learn how to streamline the supertrend read code as an indicator/ condition, i will check the PRT manual,
Regards and Thanks
12/06/2020 at 11:47 AM #152728‘d’ is still doing absolutely nothing!
1234567a = High[0] - Low[0]b = Min(Open[0], Close[0]) - Low[0]c = b/ad = c*2// Conditions to enter short positionsIF NOT ShortOnMarket AND c1 and c2 and d THEN‘d’ is just going to return (the lower shadow as a percentage of the range) x 2. It will always be a positive value so ‘and d’ will always be true.
12/06/2020 at 11:51 AM #152729yes, just an inert example i throw in,
that i’d seen somewhere in the past,
maybe someone can put life into it,
12/06/2020 at 12:05 PM #152730Try something like:
1234567a = High[0] - Low[0]b = Min(Open[0], Close[0]) - Low[0]c = b/ad = c*100// Conditions to enter short positionsIF NOT ShortOnMarket AND c1 and c2 and d <= 25 THENThis sets a condition where the lower shadow must be less than or equal to 25% of the total range.
1 user thanked author for this post.
12/06/2020 at 12:28 PM #152736Thanks,
you nailed it, d was that originally.
i should have never altered it!
Its it possible to explain the function of <= 25
does it relate to less that 25 bars?
12/06/2020 at 1:13 PM #152738No! 25 is the percentage. So the candles lower shadow is 25% or less of the candles total range.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on