Immediate at market buy code

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #87974 quote
    Tbone6060
    Participant
    New

    Is it possible to have code to buy at market immediately as the signal is generated, rather than at market which is on the open of the next candle? any help would be greatly appreciated.

    #87980 quote
    Nicolas
    Keymaster
    Master

    Yes, it is possible, but with multi timeframe coding instructions, not yet activated publicly (still beta).

    Firstly, embed all your strategy code into the desired timeframe: (15-minutes one for example)

    timeframe(15 minutes)
    test = rsi[14] crosses over 50
    

    Then, embed in timeframe “default”, the orders management. Default timeframe will be the one where the strategy will be running, so in order to get almost instantaneous code reading, send it on the smaller timeframe possible (aka 1-second TF):

    timeframe(default)
    if not onmarket and test then 
     buy at market 
    endif

    So in this example, the “test” variable will be sync with the default timeframe, the test condition will be tested each second, but with the RSI value from the 15-minutes TF.

    Also, keep in mind that the RSI value will continuously changing during the 15 minutes bar, changing its value depending of new ticks received each new second. It is possible to use the RSI value the “normal” way, with calculation made only at bar Close with “timeframe(15 minutes,updateonclose)”, but it would make no sense here as per your initial request.

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

Immediate at market buy code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Tbone6060 @tbone6060 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
7 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/04/2019
Status: Active
Attachments: No files
Logo Logo
Loading...