ProRealCode - Trading & Coding with ProRealTime™
Hello everyone.
Thank you for this amazing resource. What a great place on the internet.
I have a pine script indicator that my friend has written for Trading View and we are wanting to backtest further with ProReal Time.
Can anyone do a conversion of this script please?
If there’s any possibillity of adding Day of the week and Date to the label I would be most grateful but i’d be very happy with just the conversion if its not possible.
Mega thanks.
Darren
It would be great if you share also screenshots…
Hey Ivan
Screenshots attached. The indicator can be set to be long/short or both. The indicator shows entry, SL (stop loss) and then 1.5RR 2RR and 3RR price targets.
I set the anchor candle to 9:15am usually to start the trade on 9:30 ES Time.
Hope that helps.
I think this would be very useful indeed, I am currently looking into testing the same signal for the ASX200
Hi!
Here you have the code:
//-------------------------------------------------//
//PRC_RR Lines
//version = 0
//16.01.25
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//-------------------------------------------------//
// Inputs
//-------------------------------------------------//
StartDate=20250115
StartTime=153000
slippage=0.06
cfRangeLong=1
cfRangeShort=0
chRangeLong=0
chRangeShort=0
//-------------------------------------------------//
// parameters
//-------------------------------------------------//
candleRange=high-low
customRange=high+slippage
customRangeL=low-slippage
halfRange=candleRange/2
slipRange=candleRange+slippage
halfSlipRange=((candleRange/2)+slippage)
atr=averagetruerange[14](close)
//-------------------------------------------------//
// Custom Range Full Long
//-------------------------------------------------//
if opentime>=starttime and opentime[1]<starttime and opendate=startdate and cfRangeLong then
//Buyprice
buyprice=high+slippage+0.01
Drawsegment(barindex,buyprice,barindex+50,buyprice)coloured("green")style(dottedline3,2)
drawtext("Buy #buyprice#",barindex+25,buyprice+atr*0.25)coloured("blue")
//Stop loss
stoploss=low-0.01
Drawsegment(barindex,stoploss,barindex+50,stoploss)coloured("red")style(dottedline3,2)
drawtext("SL #stoploss#",barindex+25,stoploss+atr*0.25)coloured("blue")
//1:1.5
tp1=customrange+1.5*sliprange
Drawsegment(barindex,tp1,barindex+50,tp1)coloured("blue")style(dottedline3,2)
drawtext("(1) #tp1#",barindex+25,tp1+atr*0.25)coloured("blue")
//2:1
tp2=customrange+2*sliprange
Drawsegment(barindex,tp2,barindex+50,tp2)coloured("blue")style(dottedline3,2)
drawtext("(2) #tp2#",barindex+25,tp2+atr*0.25)coloured("blue")
//3:1
tp3=customrange+3*sliprange
Drawsegment(barindex,tp3,barindex+50,tp3)coloured("blue")style(dottedline3,2)
drawtext("(3) #tp3#",barindex+25,tp3+atr*0.25)coloured("blue")
endif
//-------------------------------------------------//
// Custom Range Full Short
//-------------------------------------------------//
if opentime>=starttime and opentime[1]<starttime and opendate=startdate and cfRangeShort then
//Shortprice
Shortprice=low-slippage-0.01
Drawsegment(barindex,Shortprice,barindex+50,Shortprice)coloured("green")style(dottedline3,2)
drawtext("Short #Shortprice#",barindex+25,Shortprice+atr*0.25)coloured("blue")
//Stop loss
stoploss=high+0.01
Drawsegment(barindex,stoploss,barindex+50,stoploss)coloured("red")style(dottedline3,2)
drawtext("SL #stoploss#",barindex+25,stoploss+atr*0.25)coloured("blue")
//1:1.5
tp1=customrangeL-1.5*sliprange
Drawsegment(barindex,tp1,barindex+50,tp1)coloured("blue")style(dottedline3,2)
drawtext("(1) #tp1#",barindex+25,tp1+atr*0.25)coloured("blue")
//2:1
tp2=customrangeL-2*sliprange
Drawsegment(barindex,tp2,barindex+50,tp2)coloured("blue")style(dottedline3,2)
drawtext("(2) #tp2#",barindex+25,tp2+atr*0.25)coloured("blue")
//3:1
tp3=customrangeL-3*sliprange
Drawsegment(barindex,tp3,barindex+50,tp3)coloured("blue")style(dottedline3,2)
drawtext("(3) #tp3#",barindex+25,tp3+atr*0.25)coloured("blue")
endif
//-------------------------------------------------//
// Custom Range Half Long
//-------------------------------------------------//
if opentime>=starttime and opentime[1]<starttime and opendate=startdate and chRangeLong then
//Buyprice
buyprice=high+slippage+0.01
Drawsegment(barindex,buyprice,barindex+50,buyprice)coloured("green")style(dottedline3,2)
drawtext("Buy #buyprice#",barindex+25,buyprice+atr*0.25)coloured("blue")
//Stop loss
stoploss=high-halfrange-0.01
Drawsegment(barindex,stoploss,barindex+50,stoploss)coloured("red")style(dottedline3,2)
drawtext("SL #stoploss#",barindex+25,stoploss+atr*0.25)coloured("blue")
//1:1.5
tp1=customrange+1.5*halfsliprange
Drawsegment(barindex,tp1,barindex+50,tp1)coloured("blue")style(dottedline3,2)
drawtext("(1) #tp1#",barindex+25,tp1+atr*0.25)coloured("blue")
//2:1
tp2=customrange+2*halfsliprange
Drawsegment(barindex,tp2,barindex+50,tp2)coloured("blue")style(dottedline3,2)
drawtext("(2) #tp2#",barindex+25,tp2+atr*0.25)coloured("blue")
//3:1
tp3=customrange+3*halfsliprange
Drawsegment(barindex,tp3,barindex+50,tp3)coloured("blue")style(dottedline3,2)
drawtext("(3) #tp3#",barindex+25,tp3+atr*0.25)coloured("blue")
endif
//-------------------------------------------------//
// Custom Range Half Short
//-------------------------------------------------//
if opentime>=starttime and opentime[1]<starttime and opendate=startdate and chRangeShort then
//Shortprice
Shortprice=customRangeL-0.01
Drawsegment(barindex,Shortprice,barindex+50,Shortprice)coloured("green")style(dottedline3,2)
drawtext("Short #Shortprice#",barindex+25,Shortprice+atr*0.25)coloured("blue")
//Stop loss
stoploss=low+halfrange+0.01
Drawsegment(barindex,stoploss,barindex+50,stoploss)coloured("red")style(dottedline3,2)
drawtext("SL #stoploss#",barindex+25,stoploss+atr*0.25)coloured("blue")
//1:1.5
tp1=customrangeL-1.5*halfsliprange
Drawsegment(barindex,tp1,barindex+50,tp1)coloured("blue")style(dottedline3,2)
drawtext("(1) #tp1#",barindex+25,tp1+atr*0.25)coloured("blue")
//2:1
tp2=customrangeL-2*halfsliprange
Drawsegment(barindex,tp2,barindex+50,tp2)coloured("blue")style(dottedline3,2)
drawtext("(2) #tp2#",barindex+25,tp2+atr*0.25)coloured("blue")
//3:1
tp3=customrangeL-3*halfsliprange
Drawsegment(barindex,tp3,barindex+50,tp3)coloured("blue")style(dottedline3,2)
drawtext("(3) #tp3#",barindex+25,tp3+atr*0.25)coloured("blue")
endif
//-------------------------------------------------//
return
Hi Ivan and everyone else.
It’s taken a lot longer than expected to load the indicator but i’ve now done it. Currently I only see the long side to the indicator and the short side doesn’t load. I’ll post screenshots to show you what happens in prorealtime and what should happen in if it were in TradingView.
Is it possible to remove the 1R:1 line and instead add a 4:1 and a 5:1 reward to risk line please? If 3R, 4R and 5R are all in different colours that would be great.
I have updated the TradingView pine script code to include 4:1 and 5:1. let me know if you want me to supply the updated pinescript code.
Thanks,
Darren
Hi Darren,
Ivan has given us customisations!
If you load the indicator on the price chart, you can click on it and use ‘Configure’ with the spanner symbol. Look below Start Date and Slippage. Check the box CFRangeShort and you will have short targets printed same as the long.
As for the other requests you may have to adapt that in your code provided. You could just copy/paste “tp3=customrange+3*sliprange” and add TP4 etc using the block of code for each drawing description. The colour can be changed there too.
I’m testing this out and looks like a pretty fun way to deal with opening drives on my market. Beware the double losses though, I will only trade this once a day to minimise whipsaws.
What market do you trade this on?
CC
School Run style strategy indicator to Pro Build
This topic contains 6 replies,
has 3 voices, and was last updated by coincatcha
12 months ago.
| Forum: | ProBuilder: Indicators & Custom Tools |
| Language: | English |
| Started: | 01/14/2025 |
| Status: | Active |
| Attachments: | 7 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.