Novice Needs help with PRT
Forums › ProRealTime English forum › ProOrder support › Novice Needs help with PRT
- This topic has 14 replies, 5 voices, and was last updated 3 years ago by
phoentzs.
-
-
01/19/2022 at 9:34 PM #185978
Hi, Im new to PRT, coding and programming.
I have a little bit of trading knowledge.
I need help with 2 items:
- If I do a back test I need to enter the market at “current period” and not “next bar open”, as this is too late (see image attached).
How can I change this or manually change the code.
The code is:
123456789101112131415161718// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsindicator1 = close-close[1]c1 = (indicator1 >= 5)IF c1 THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to enter short positionsindicator2 = close-close[1]c2 = (indicator2 <= -5)IF c2 THENSELLSHORT 1 CONTRACT AT MARKETENDIF2. If I set the back test date manually it ignores it and uses the displayed time only, how do I correct this.
Humble regards
01/19/2022 at 10:38 PM #185991If it’s any help, we all have to enter at next bar open … that’s the way PRT works (and I think, all other Platforms?).
Time difference between current bar close and next bar open is only a few milliseconds; the price is therefore as near the same (current close to next open) as makes no difference.
01/19/2022 at 11:20 PM #185997Your pic shows you are using a 1-minute TF.
You could use MTF (Multiple Time Frame) support to use a default 1-second TF to be able to enter as quick as 1 second after your conditions are met, without having to wait for the 1-minute candle to close.
01/19/2022 at 11:51 PM #185999Hi, thanks for you help.
What I want to do is to enter a long position if the change of price is 5 points/pips within 1 minute tf bar, the trade must then be executed on the 1 second tf, So immediate if it reached 5 point it must buy, how will that coding look?
I looked at the mtf coding and this is what I developed, not sure if its correct:
If I use this then I get the message that timeframes don’t match….
12345678910111213141516// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated//declare the strategy on the 1 minute timeframetimeframe(1 minute, updateonclose)//Conditions to enter long positions on the 1 second timeframetimeframe(1 second, default)// Conditions to enter long positionsindicator1 = close-close[1]c1 = (indicator1 >= 5)IF c1 THENBUY 1 CONTRACT AT MARKETENDIF01/19/2022 at 11:52 PM #186000Ok thanks, I don’t really have an idea how this work. You can check my other reply on this topic to see what I want to do.
Regards
01/20/2022 at 12:11 AM #186001This your code ready to run:
1234567891011121314// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated//declare the strategy on the 1 minute timeframetimeframe(1 minute, default)indicator1 = close-close[1]//Conditions to enter long positions on the 1 second timeframetimeframe(default)// Conditions to enter long positionsc1 = (indicator1 >= 5*PipSize)IF c1 THENBUY 1 CONTRACT AT MARKETENDIF01/20/2022 at 10:06 AM #186024Hi, when I run that code I get this error (see image), i tried to fix it but could not get it right.
What I want to do is to enter a long position if the change of price is 5 points within 1 minute tf bar, the trade must then be executed on the 1 second tf, So immediate if it reached 5 in 1 bar tf point it must buy.
It will main ly be for CFD indices so will the “*pipsize” be required.
Thanks for your help, im trying to make sense of all of this.
01/20/2022 at 10:15 AM #186030Hello Francois – Try this version :
123456789101112131415// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated//declare the strategy on the 1 minute timeframetimeframe(1 minute, default)indicator1 = close-close[1]//Conditions to enter long positions on the 1 second timeframetimeframe(default)// Conditions to enter long positionsc1 = (indicator1 >= 5*PipSize)If C1 thenBUY 1 CONTRACT AT MARKETENDIFRoberto is playing with his new Editor which left some strange characters behind. 🙂
Peter1 user thanked author for this post.
01/20/2022 at 12:03 PM #186048Thanks Peter & Roberto, when I run that code no trades get activated.
Im trying to develop a scalping strategy but struggling with the code.
I want to enter a long position if the change of price is 4 points within 1 minute tf bar, the trade must then be executed immediately on the 1 second tf, So immediate if it reached +4 points in 1 minutetf point it must buy.
The TP will be 1 points and the SL will be 1 points after activation.
I want to enter a short position if the change of price is -4 points within 1 minute tf bar, the trade must then be executed immediately on the 1 second tf, So immediate if it reached -4 points in 1 minute tf point it must sell.
The TP will be 1 points and the SL will be 1 points after activation.
<span style=”text-decoration: underline;”>The code from the PRT simplifier looks likes this:</span>
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positions
indicator1 = close-close[1]
c1 = (indicator1 >= 4)IF c1 THEN
BUY 1 CONTRACT AT MARKET
ENDIF// Conditions to enter short positions
indicator2 = close-close[1]
c2 = (indicator2 <= -4)IF c2 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF// Stops and targets
SET STOP pLOSS 1
SET TARGET pPROFIT 1The problem with this code is that it then executes the trade on the next 1 minute bar which by then is too late and the trade is a loss, as it does not allow for MTF.
The image attached at point 1 shows 4 point change (where i want to buy) and it went beyond 5 points (where i want to exit long at 5 point). Point 2 shows -4 point change (where i want to short) and it went beyond 5 points (where i want to exit long at 5 points).
So I would scalp 1 pont at each of these positions
How will that code look?
01/20/2022 at 12:21 PM #186052You don’t need to post your code at every post, unless you have modified it.
You need to use 200K 1-second bars, which is barely 10 days.
If that is not enough to open a trade then you have to resort to, say, 10 seconds (but this won’t change much about data history), or you need to use your original code and open only when the 1-minute candle closes.
There’s no further option available.
01/20/2022 at 12:23 PM #18605301/20/2022 at 12:27 PM #186054So I would scalp 1 pont at each of these positions
Spread is more than 1 point on most Indices, even DAX is 1.2 so you lose 0.2 on each trade? EURUSD is 0.6 sometimes! 🙂
Get the System going with loads of trades and you can adjust / optimise TP and SL later.
01/20/2022 at 2:09 PM #186065Thanks for all your input and advise.
If I make my analysis timeframe one second, which could enter the position on the “next bar open” (next second) but the condition is that the change in point must be 4 and -4 (long and short) on the 1 minute timeframe, how will that look.
01/20/2022 at 2:30 PM #186069See attached, if you want to go back to >= 4 then replace A13 and A14 with 4.
Otherwise I’ve set up A13 and A14 for you in the optimiser.
Run below on 1 second TF.
1234567891011121314151617181920DEFPARAM CumulateOrders = False // Cumulating positions deactivated//declare the strategy on the 1 minute timeframetimeframe(1 minute)indicator1 = close-close[1]Indicator2 = close[1]-close//Conditions to enter long positions on the 1 second timeframetimeframe(default)// Conditions to enter long positionsc1 = indicator1 >=A13*PipSizeC2 = Indicator2 >=A14*pipsizeIf C1 thenBUY 1 CONTRACT AT MARKETENDIFIf C2 ThenSellShort at MarketEndif01/21/2022 at 4:49 AM #186131 -
AuthorPosts
Find exclusive trading pro-tools on