Orders do not execute

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #187294 quote
    sam
    Participant
    New

    Hi,

    I am just new to Prorealtime. I have been trying to place orders through pre-defined strategies on a demo account. But orders do not execute. I have tested an order as simple as below. But still no luck. It would be so much appreciated if I can get some help to undrestand why my orders do not execute.

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    BUY 1 SHARE AT MARKET

    // Stops and targets
    SET STOP %LOSS 10
    SET TARGET %PROFIT 1

    #187295 quote
    PeterSt
    Participant
    Master

    Hi there Sam,

    Is the Market open for the chart / instrument you are trying this on ?

    Is the TimeFrame of the chart sufficiently small (like 1 minute) to test it, hence wait for the next bar to occur which is when your code will be called ?

    Regards and welcome !
    Peter

    image_2022-02-02_050520.png image_2022-02-02_050520.png
    #187412 quote
    sam
    Participant
    New

    Hi Peter,

    Thanks for your help. Market is not open as I am in Australian and I am trying to pre order my strategies to get executed at market open in US. I will try with a smaller time frame. However, I believe in this scenario I have to limit the entries to 1 per day.

    Best Regards

    Sam,

    #187418 quote
    PeterSt
    Participant
    Master

    Sam, I am not even sure what happens in your situation, because it depends on settings and order type. However, would you try a normal manual order in this situation, and it is not accepted (message about the market being closed) then you can bet that with the AutoTrade program just nothing will happen (no error message, which would be normal behavior IMO).

    1. Try to find a manual order (type) which is accepted pre-market (should be a Limit order which you can always throw out again before it is filled).
    2. When found, try to code that (something with the LIMIT keyword in the Buy xx contracts (etc.) command.
    3. But try to figure out whether it will do what you want to achieve in the first place.

    And do notice that you will not be the first one who tries what you just described via AutoTrading, while a manual order could do just that for you. Read :
    When you found that command by manual trading, you will see that you are set and done. 🙂 … No AutoTrading required …

    Oh, do notice that for you this is related to a. being able to trade outside of regular trading hours while b. you do NOT want that (otherwise a Market order is filled right away (if someone wants to sell at that moment). Investigate ETH (Extended Trading Hours). You would want those Off. See attachment. I have it On and I would not be able to do what you want in the first place. Please notice : this is PRT-IB (Interactive Brokers). For PRT-IG this setting does not exist in the first place (AFAIK) and whether you can trade in ETH I don’t know (but if Yes, you won’t achieve what you want).

    Peter

    #187565 quote
    sam
    Participant
    New

    Hi Peter,

    Thanks a lot for your detailed explanation. It helped a lot. I am making a good progress.

    Regards,

    Sam

    #187853 quote
    sam
    Participant
    New

    Hi,

    I have seen people use a code similar to the below successfully. I eliminated all the conditions just to check if I can simply open a position. The time frame was 1 minute. But multiple attempts to open a position were mainly failed. Worked in 2 occasions though. I need some help to understand what I am doing wrong ?

    Regards,

    Sam

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Condition to do 1 trade per day
    Once TradeON = 1
    //
    If IntraDayBarIndex = 0 then
    TradeON = 1
    Endif
    //
    If OnMarket or StrategyProfit <> StrategyProfit[1] Then
    TradeON = 0
    Endif
    //
    IF TradeON and Not OnMarket THEN
    SELLSHORT 10000 CASH AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP %LOSS 30
    SET TARGET %PROFIT 2
    #187855 quote
    PeterSt
    Participant
    Master

    Hi Sam,

    You logic works, but your line 20 messes up with things. This works better :

    SET STOP %LOSS 0.3 //30

    Unless you really want to make 30% profit, an order waiting for that 30% hangs in there forever.
    That may happen, but not for a while. So this “mainly” fails. 😉

    Regards,
    Peter

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

Orders do not execute


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
sam @samrsco-com-au Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by PeterSt
4 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/02/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...