PRT Bands with wick pressure
Forums › ProRealTime English forum › ProOrder support › PRT Bands with wick pressure
- This topic has 9 replies, 2 voices, and was last updated 1 year ago by Aragorna.
-
-
03/05/2023 at 3:08 AM #210906
Hi Nicolas,
I would ask for a help in my simple strategy using PRt Bands (I’ve used different interesting pieces of indicators found in the forum)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsEXP1 = ExponentialAverage[1](close)up = PRTBANDSUPdn = PRTBANDSDOWNa = PRTBandsmediumtermif close crosses over up and trend<=0 then //prezzo supera banda superioretrend=1elsif close crosses under dn and trend>=0 then //prezzo ribassa banda inferioretrend=-1ENDIFc4 = trend<>trend[1]ONCE Periods = 60ONCE hi1 = 0ONCE hi2 = 0ONCE hi3 = 0ONCE lo1 = 0ONCE lo2 = 0ONCE lo3 = 0Bullish = close > openBearish = close < openNewHigh = (high = highest[Periods](high))NewLow = (low = lowest[Periods](low))HIswing = Bullish[1] AND Bearish AND NewHigh[1]LOswing = Bearish[1] AND Bullish AND NewLow[1]IF HIswing THENhi3 = hi2hi2 = hi1hi1 = high[1]ENDIFIF LOswing THENlo3 = lo2lo2 = lo1lo1 = low[1]ENDIFc5 = a > lo1 and hi1 >hi2//condizione per entrare LongIF NOT longonmarket and Trend=1 and c4 and c5 thenBUY 10 SHARES AT MARKETENDIF// Conditions to exit long positions//IF longonmarket and TREND=-1 and c4 THENIF longonmarket and close<lo1 THENSELL AT MARKETENDIF//condizione per entrare Short//IF NOT shortonmarket and Trend=-1 and c4 then//SELL 10 SHARES AT MARKET//ENDIF// Conditions to exit short positions//IF shortonmarket and TREND=1 and c4 THEN//BUY AT MARKET//ENDIFI’d like to add the use of this amazing indicator Wick pressure https://www.prorealcode.com/prorealtime-indicators/wick-pressure/
How can I add the conditon that when trend changes from red to green, there have been wick pressure in the last red trend ? that could helpful to filter many enters long. last question, in the strategy I have deactiveted enter shorts because for some reason it doesn’t work. I know that PRT bands has not be designed to work short but it should work the same, right ? I’ve thought the strategy for large cap stocks, when sstocks are in pre market or after market, is it correct to use buy at market? I know that in pre market and after market Proreal time work only with order limit, my doubt is that in backtest it work but in live it does not work. How could I change the strategy, if it’s this the case?
thank’s for any help you could give me
AleX
03/13/2023 at 6:24 PM #211498First you need to modify the indicator so that it returns a value indicating the type of rectangle, I put 1=green and -1=red:
123456789101112131415161718192021222324252627282930313233//PRC_Wick Pressure | indicator//23.05.2022//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge//converted from pinescript// --- settings//atrmult = 0.7 //ATR Multiplier (The Wick area is filtered on the basis of atr and this is multiplier to that ATR. The more the multiplier value, the less the signals and vice versa)//boxlength = 16 //Length of Wick Pressure Box//rsiob = 60 //RSI based on which signnals are filtered//rsios = 40 //RSI based on which signnals are filtered// --- end of settingsmeersi = rsi[14](close)signal = 0//bullish wick pressurersibullishcond = meersi < rsios or meersi[1] < rsios or meersi[2] < rsiosll3 = lowest[3](low)lc3 = min(lowest[3](close),lowest[3](open))if low<=lc3 and low[1]<=lc3 and low[2]<=lc3 and open>=lc3 and open[1]>=lc3 and open[2]>=lc3 and lc3-ll3>(atrmult*AverageTrueRange[14](close)) and rsibullishcond and close>open thendrawrectangle(barindex,lc3,barindex+boxlength, ll3) coloured("green",50) bordercolor("green")signal = 1endif//bearish wick pressurersibearishcond = meersi > rsiob or meersi[1] > rsiob or meersi[2] > rsiobhh3 = highest[3](high)hc3 = max(highest[3](close), highest[3](open))if high>=hc3 and high[1]>=hc3 and high[2]>=hc3 and open<=hc3 and open[1]<=hc3 and open[2]<=hc3 and hh3-hc3>(atrmult*AverageTrueRange[14](close)) and rsibearishcond and close<open thendrawrectangle(barindex,hh3,barindex+boxlength, hc3) coloured("red",50) bordercolor("red")Signal = -1endifreturn Signal AS "Signal"after which it enters when C4 is true (change of Trend), provided that in the previous change there was at least one signal (it doesn’t matter which one because I’m not sure which one should be taken into consideration, if the Red one or the Green one):
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivatedONCE Segnale = 0// Conditions to enter long positionsEXP1 = ExponentialAverage[1](close)up = PRTBANDSUPdn = PRTBANDSDOWNa = PRTBandsmediumtermif close crosses over up and trend<=0 then //prezzo supera banda superioretrend=1elsif close crosses under dn and trend>=0 then //prezzo ribassa banda inferioretrend=-1ENDIFc4 = trend<>trend[1]Segnale = CALL "PRC_Wick Pressure v2"[0.7, 16, 60, 40]IF Segnale <> Segnale[1] THENEntrata = Segnale[1]ENDIFONCE Periods = 60ONCE hi1 = 0ONCE hi2 = 0ONCE hi3 = 0ONCE lo1 = 0ONCE lo2 = 0ONCE lo3 = 0Bullish = close > openBearish = close < openNewHigh = (high = highest[Periods](high))NewLow = (low = lowest[Periods](low))HIswing = Bullish[1] AND Bearish AND NewHigh[1]LOswing = Bearish[1] AND Bullish AND NewLow[1]IF HIswing THENhi3 = hi2hi2 = hi1hi1 = high[1]ENDIFIF LOswing THENlo3 = lo2lo2 = lo1lo1 = low[1]ENDIFc5 = a > lo1 and hi1 >hi2//condizione per entrare LongIF NOT longonmarket and Trend=1 and Entrata[1] and c4 and c5 thenBUY 10 SHARES AT MARKETENDIF// Conditions to exit long positions//IF longonmarket and TREND=-1 and c4 THENIF longonmarket and close<lo1 THENSELL AT MARKETENDIF//condizione per entrare Short//IF NOT shortonmarket and Trend=-1 and c4 then//SELL 10 SHARES AT MARKET//ENDIF// Conditions to exit short positions//IF shortonmarket and TREND=1 and c4 THEN//BUY AT MARKET//ENDIF//graph c4//graph Segnale//graph Entrataif you want to specify the type of rectangle that should have been diaplayed before the trend change, just tell me.
03/13/2023 at 7:42 PM #211506Hi Roberto,
thank you for your amazing work.
since PRT bands work only for long, I need to enter long only when the green bullish rectangle is in the red trend before the change of trend (for PRT bands). if possible.
thank’s in advance
03/13/2023 at 7:45 PM #211507is it possible to define both the conditions, bullish pressure and bearish pressure? green bullish rectangle when trend is red (so before the change of trend to green on PRT bands) and viceversa for bearsh red rectangle. Then it will be on me to define a condition for short instead of long. For bearish I was thinking to use Supertrend
03/22/2023 at 9:23 AM #211908Hi Roberto,
I know you’re very busy, but I’d like to ask a suggestion for the code in a simpler way in order not to use mcuh of your time, I’ve tried to do it but there ‘s something that I don’t get. How can I do a buy order when the wick bullish pressure gives the signal and viceversa a sell order when a wick bearish pressure signal gives the signal? also if possible a stop limit order above the rectangle (for green) or below the rectangle (for red) ?
thank you very much in advance
Alex
05/02/2023 at 11:49 AM #213976Sorry for the delay.
I coded this update:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivatedONCE Segnale = 0// Conditions to enter long positionsEXP1 = ExponentialAverage[1](close)up = PRTBANDSUPdn = PRTBANDSDOWNa = PRTBandsmediumtermif close crosses over up and trend<=0 then //prezzo supera banda superioretrend=1elsif close crosses under dn and trend>=0 then //prezzo ribassa banda inferioretrend=-1ENDIFc4 = trend<>trend[1]Segnale = CALL "PRC_Wick Pressure v2"[0.7, 16, 60, 40]IF Segnale <> Segnale[1] THENEntrata = Segnale[1]ENDIFONCE Periods = 60ONCE hi1 = 0ONCE hi2 = 0ONCE hi3 = 0ONCE lo1 = 0ONCE lo2 = 0ONCE lo3 = 0Bullish = close > openBearish = close < openNewHigh = (high = highest[Periods](high))NewLow = (low = lowest[Periods](low))HIswing = Bullish[1] AND Bearish AND NewHigh[1]LOswing = Bearish[1] AND Bullish AND NewLow[1]IF HIswing THENhi3 = hi2hi2 = hi1hi1 = high[1]ENDIFIF LOswing THENlo3 = lo2lo2 = lo1lo1 = low[1]ENDIFc5 = a > lo1 and hi1 >hi2//condizione per entrare LongIF NOT longonmarket and Trend=1 and Entrata[1] = -1 and c4 and c5 thenBUY 10 SHARES AT MARKETENDIF// Conditions to exit long positions//IF longonmarket and TREND=-1 and c4 THENIF longonmarket and close<lo1 THENSELL AT MARKETENDIF//condizione per entrare ShortIF NOT shortonmarket and Entrata = 1 and c4 thenSELLSHORT 10 SHARES AT MARKETENDIF// Conditions to exit short positionsIF shortonmarket and TREND=1 and c4 THENEXITSHORT AT MARKETENDIF//graph c4//graph Segnale//graph Entrata05/03/2023 at 11:07 PM #214096Hi Roberto,
thank’s for your update and time. Strategy does not work, sometimes goes long outside green rectangle and sometimes it goes short in green rectangle and viceversa, it works random. Can I ask you please if it’s possible to forget the strategy and focus only on wick pressure.
A strategy that goes long when there is bullish condition and goes short on red rectangle with bearish condition. Condition for exit long Position when there is short bearish condition, and viceversa for short. Hope to be clear. Then I’ll take care of adding other indicators or conditions.
Thank’s in advanceAlessio05/03/2023 at 11:27 PM #214097Hi Roberto. could be something like this? the strange thing is that doing the backtest I see the positions opened in the chart but the detailed report shows Zero positions opened. I don’t understand why
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivatedONCE Segnale = 0// Conditions to enter long positions//PRC_Wick Pressure | indicator//23.05.2022//Nicolas @ www.prorealcode.com//Sharing ProRealTime knowledge//converted from pinescript// --- settingsatrmult = 0.7 //ATR Multiplier (The Wick area is filtered on the basis of atr and this is multiplier to that ATR. The more the multiplier value, the less the signals and vice versa)//boxlength = 16 //Length of Wick Pressure Boxrsiob = 60 //RSI based on which signnals are filteredrsios = 40 //RSI based on which signnals are filtered// --- end of settingsmeersi = rsi[14](close)signal = 0//bullish wick pressurersibullishcond = meersi < rsios or meersi[1] < rsios or meersi[2] < rsiosll3 = lowest[3](low)lc3 = min(lowest[3](close),lowest[3](open))if low<=lc3 and low[1]<=lc3 and low[2]<=lc3 and open>=lc3 and open[1]>=lc3 and open[2]>=lc3 and lc3-ll3>(atrmult*AverageTrueRange[14](close)) and rsibullishcond and close>open then//drawrectangle(barindex,lc3,barindex+boxlength, ll3) coloured("green",50) bordercolor("green")signal = 1BarLongsignal=BarindexendifIf Barindex=BarLongsignal+2 thenSignal=0endif//bearish wick pressurersibearishcond = meersi > rsiob or meersi[1] > rsiob or meersi[2] > rsiobhh3 = highest[3](high)hc3 = max(highest[3](close), highest[3](open))if high>=hc3 and high[1]>=hc3 and high[2]>=hc3 and open<=hc3 and open[1]<=hc3 and open[2]<=hc3 and hh3-hc3>(atrmult*AverageTrueRange[14](close)) and rsibearishcond and close<open then//drawrectangle(barindex,hh3,barindex+boxlength, hc3) coloured("red",50) bordercolor("red")Signal = -1BarShortsignal=BarindexIf Barindex=Barshortsignal+2 thenSignal=0endifendif//condizione per entrare LongIF NOT longonmarket and Signal = 1 thenBUY 1 SHARES AT MARKETENDIF// Conditions to exit long positions//condizione per entrare ShortIF NOT shortonmarket and signal = -1 thenSELLSHORT 1 SHARES AT MARKETENDIF// Conditions to exit short positions//graph c4//graph Segnale//graph Entrataset stop %loss 2set stop %profit 4can you help me ,please? thank’s in advance
Alessio
05/07/2023 at 11:07 AM #214258Signals are returned by the indicator.
Do you need to change it?
Can you explain me when it has to enter Long and Short, when a rectangle starts or ends, when it’s Red or Green?
05/08/2023 at 11:02 AM #214285Hi roberto, when a bullish signal appear on a candle , I would like to set a stop limit some pipes above the high of that candle, viceversa for short, when a bearish signal appears, a short stop limit some pipes below that candle.
thank’s in advance
Alessio
-
AuthorPosts
Find exclusive trading pro-tools on