Code : Basic building Blocks

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #64196 quote
    PVPRO
    Participant
    Junior

    Can some one provide me the basic building blocks on following topic that can be used for coding.

    1. Time (Hr, Min, Sec), relation of this time with system time
    2. Buy/Sell at Market price or at Market price + cushion of few points (to avoid slippage)
    3. Traded (bought/sold) price & current price
    4. Stop loss in % of traded price & with cushion of few points to avoid slippage , Stop loss applicable only if trade happen

    Thanks.

    PV

    #64200 quote
    GraHal
    Participant
    Master

    Hi 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

    https://www.prorealtime.com/en/partner_redirect.phtml?pr_page=help/quick_tour&pr_from=PRT_IG&version=v10.3.20171104030011

    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
    GraHal

    #64258 quote
    PVPRO
    Participant
    Junior

    Hi GraHal

     

    Thanks for that information. I quickly scanned it & still not found information specific to my queries.

    I mean c

    1. What command of programming used in code to define execution of trade at specific time.
    2. 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?
    3. 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?
    4. 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

    #64270 quote
    Despair
    Blocked
    Master

    If 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:

    if time =080000 then
      buy 1 contract at market
    endif
    #64272 quote
    GraHal
    Participant
    Master

    We 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 …

    1.  HrsMinsSeconds as in 080000 (as Despair example above).
    2. 2400 + 2*pipsize or 2400 -2*pipsize
    3.  Tradeprice(N) where N is Nth last order.  Note Tradeprice(1) could be the current open trade.
    4. Sell at 2405-2*pipsize Stop. ExitShort at 2405+2*pipsize Stop.

    Cheers
    GraHal

    #64276 quote
    GraHal
    Participant
    Master

    If 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/

    Nicolas thanked this post
    #64537 quote
    PVPRO
    Participant
    Junior

    Thanks 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.

    #64552 quote
    GraHal
    Participant
    Master

    Best 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).

    PV-1.jpg PV-1.jpg PV.jpg PV.jpg
    #64695 quote
    PVPRO
    Participant
    Junior

    Thanks 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).

    1. Daily buy at 9.40AM & sell at 3.50PM. Other conditions I will add.
    2. Daily buy at Open (means at 9.30AM) & sell at Close (means at 4.00PM). Other conditions i will add.

    Thanks.

    #64700 quote
    GraHal
    Participant
    Master
    If Time = 094000 and Conditions Then
    
    Buy Lot size at Market
    
    Endif   
    
    If Time = 155000 and Conditions Then
    
    Sell at Market
    
    Endif 
    
    If Time = 093000 and Conditions Then
    
    Buy Lot size at Market
    
    Endif   
    
    If Time = 160000 and Conditions Then
    
    Sell at Market
    
    Endif

    You 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

    #64801 quote
    PVPRO
    Participant
    Junior

    Hi 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.

    #64803 quote
    PVPRO
    Participant
    Junior

    Hi GraHal

    But my broker is UK based (IG.com). So for US 9.30 AM & 4.00PM do I need to change time as 14.30 & 21.00 respectively in above code?

    Thanks.

    #64804 quote
    GraHal
    Participant
    Master

    What have you got your Platform set to??

    I have my Platform set to same as my computer clock / Big Ben 🙂 … UTC + 0  … see attached

    PV-2.jpg PV-2.jpg
    #65387 quote
    PVPRO
    Participant
    Junior

    Hi 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.

    Time.png Time.png
    #65389 quote
    PVPRO
    Participant
    Junior

    Hi 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.

Viewing 15 posts - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.

Code : Basic building Blocks


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
PVPRO @pvpro Participant
Summary

This topic contains 21 replies,
has 3 voices, and was last updated by GraHal
7 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/01/2018
Status: Active
Attachments: 4 files
Logo Logo
Loading...