Orders do not execute
Forums › ProRealTime English forum › ProOrder support › Orders do not execute
- This topic has 6 replies, 2 voices, and was last updated 3 years ago by
PeterSt.
-
-
02/02/2022 at 4:09 AM #187294
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 deactivatedBUY 1 SHARE AT MARKET
// Stops and targets
SET STOP %LOSS 10
SET TARGET %PROFIT 102/02/2022 at 5:06 AM #187295Hi 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 !
Peter02/03/2022 at 1:28 AM #187412Hi 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,
02/03/2022 at 5:31 AM #187418Sam, 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).
- 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).
- When found, try to code that (something with the LIMIT keyword in the Buy xx contracts (etc.) command.
- 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
02/05/2022 at 2:55 AM #18756502/08/2022 at 1:01 AM #1878531Hi,
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
123456789101112131415161718192021// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Condition to do 1 trade per dayOnce TradeON = 1//If IntraDayBarIndex = 0 thenTradeON = 1Endif//If OnMarket or StrategyProfit <> StrategyProfit[1] ThenTradeON = 0Endif//IF TradeON and Not OnMarket THENSELLSHORT 10000 CASH AT MARKETENDIF// Stops and targetsSET STOP %LOSS 30SET TARGET %PROFIT 202/08/2022 at 5:20 AM #187855Hi Sam,
You logic works, but your line 20 messes up with things. This works better :
1SET STOP %LOSS 0.3 //30Unless 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 -
AuthorPosts
Find exclusive trading pro-tools on