Code : Basic building Blocks
Forums › ProRealTime English forum › ProOrder support › Code : Basic building Blocks
- This topic has 21 replies, 3 voices, and was last updated 7 years ago by
GraHal.
-
-
03/01/2018 at 9:13 PM #64196
Can some one provide me the basic building blocks on following topic that can be used for coding.
- Time (Hr, Min, Sec), relation of this time with system time
- Buy/Sell at Market price or at Market price + cushion of few points (to avoid slippage)
- Traded (bought/sold) price & current price
- Stop loss in % of traded price & with cushion of few points to avoid slippage , Stop loss applicable only if trade happen
Thanks.
PV
03/02/2018 at 12:24 AM #64200Hi PV, welcome aboard!
Have you seen Nicolas Videos and / or the PRT Manuals etc?
https://www.prorealcode.com/topic/training-videos-programming-with-prorealtime/
https://www.prorealtime.com/en/pdf/doccomplete_c1442925883c.pdf
https://www.prorealtime.com/en/pdf/probacktest.pdf
A lot of us would likely benefit from a re-read of the manuals etc … including me! 🙂
I may just do that now I’ve said it! 🙂
Cheers
GraHal03/03/2018 at 9:25 AM #64258Hi GraHal
Thanks for that information. I quickly scanned it & still not found information specific to my queries.
I mean c
- What command of programming used in code to define execution of trade at specific time.
- If we want to add cushion for limit order avoid slippage Then what command of programming used in code? eg. requirement : Buy at (2400.00 +/- 2.0). Then how do we define that +/- 2.0?
- If trade at 2401 & thereafter we want to compare it with something then what define this traded price of 2401? I mean “buy price” or something else?
- For stop loss if how to add cushion in programming? eg. required stop loss if (2405 +/- 2.0) the how do we define in code that +/-2.0?
Can I have answers to above questions by you expert people?
Thanks.
PV
03/03/2018 at 11:39 AM #64270If you read the pro backtest PDF Grahal linked to you should find answers to your questions. Additionally the help function within the PRT editor is very good. For example the command time gives you the time of the day. For example:
123if time =080000 thenbuy 1 contract at marketendif03/03/2018 at 12:53 PM #64272We are not avoiding / don’t want to answer PVPRO we just felt you needed to know where all the reference handbooks are?
And of course any term can be input into Search on this site (on the dropdown by your pic top right).
But re your questions …
- HrsMinsSeconds as in 080000 (as Despair example above).
- 2400 + 2*pipsize or 2400 -2*pipsize
- Tradeprice(N) where N is Nth last order. Note Tradeprice(1) could be the current open trade.
- Sell at 2405-2*pipsize Stop. ExitShort at 2405+2*pipsize Stop.
Cheers
GraHal03/03/2018 at 1:07 PM #64276If you need info re Terms then it’s probably better to use the link below which is on the drop down under Help at the top of each screen on this Site
https://www.prorealcode.com/prorealtime-documentation/
1 user thanked author for this post.
03/06/2018 at 7:31 AM #64537Thanks GraHal & Despair
I will go through the valued information you have provided.
Just quick question. If we are trading Index CFD, the how do we define stop loss as +/-0.01% of traded prices & Buy Limit price +/-0.01% of Limit price? since pips not applicable for indices CFD.
Thanks.
03/06/2018 at 10:18 AM #64552Best you look up all the Options in the coding window under Fx as shown attached. There are definitions for each.
Pips or points are applicable for Indices, but best always to use x*pipsize or x*pointsize then it will work on all Trading Instruments (Forex and Commodities etc).
03/07/2018 at 7:23 PM #64695Thanks GraHal.
As I am learning could you please help for the code for following two requirements. I tried many times but could not get it.
For S&P500 Daily charts (Time as per US trading hours 9.30AM to 4.00PM).
- Daily buy at 9.40AM & sell at 3.50PM. Other conditions I will add.
- Daily buy at Open (means at 9.30AM) & sell at Close (means at 4.00PM). Other conditions i will add.
Thanks.
03/07/2018 at 9:37 PM #647001234567891011121314151617181920212223If Time = 094000 and Conditions ThenBuy Lot size at MarketEndifIf Time = 155000 and Conditions ThenSell at MarketEndifIf Time = 093000 and Conditions ThenBuy Lot size at MarketEndifIf Time = 160000 and Conditions ThenSell at MarketEndifYou need to convert the times to US Times (UTC – 5 for me ) so 093000 becomes 143000 for me that is.
What is your UTC Time Standard / Zone??
https://www.timeanddate.com/worldclock/converted.html?p1=179&p2=0
03/08/2018 at 2:26 PM #64801Hi GraHal
Thanks for your guidance.
I will check code today & will update.
I am in UAE (UTC +04.00) time. So What do I need to change in Prorealtiem for chart & for above code to get above mentioned US trading time?
One more question how can I get Stochastic based on O,H,L,C prices captured with respect to US trading time (9.30AM to 4.00PM)?
Thanks.
03/08/2018 at 2:35 PM #6480303/08/2018 at 2:52 PM #6480403/15/2018 at 8:05 PM #65387Hi GraHal
Thanks for your support.
Now time based code is working. However it works only when time selected is multiple of time used in code. I mean if we want to buy at 091000 Then time frame selected should be 5 or 10 minutes. It does not work if time frame is 15, 30 minutes or Hrs. Am I correct? Why it is so?
Could you please advice, what time daily candle open & close when attached custom trading Hrs are set? I expect daily candle to open at 17.30 & Close at 23.00. Is it the same consideration by prorealtime software?
Also please advice, for stochastic formula mentioned in the attached strategy what is time to open & time to close are considered for above mentioned customer trading Hrs for daily candle? I mean for daily candle I expect time to open as 17.30, time to close as 23.00 & time for High & Low will be anything between it or including it. Is is the same consideration by prorealtime software?
Thanks.
03/15/2018 at 8:15 PM #65389Hi GraHal
Also please advice how we can achieve long & short trades in one strategy (one at a time) ? eg. Long will be based on certain condition. If this condition is not satisfied the short position will be taken. Long position stop triggers, Short position should open. If Short position stop loss triggers, Long position will open. At the end, whether Long or Short, open position should close at the end of Candle.
Thanks.
-
AuthorPosts
Find exclusive trading pro-tools on