Sell Order entry at or near close of trading
Forums › ProRealTime English forum › ProOrder support › Sell Order entry at or near close of trading
- This topic has 9 replies, 4 voices, and was last updated 7 years ago by
Vonasi.
-
-
07/17/2018 at 11:41 AM #76129123456789101112131415161718192021222324DEFPARAM CumulateOrders = True // Cumulating positions allowed// Conditions to enter short positionsindicator1 = RSI[4](close)c1 = (indicator1 > 70)indicator3 = 0if (CurrentTime = 205500) and close[0] > close[1] thenindicator3 =1endifif (CurrentTime = 205900) thenindicator3 = 0endifc3 = (indicator3 =1)IF c1 and c3 THENSELLSHORT 1 PERPOINT AT MARKETENDIF// Conditions to exit short positionsindicator2 = Average[5](close)c2 = (close CROSSES UNDER indicator2)IF c2 THENEXITSHORT AT MARKETENDIF
The above doesn’t work is there any way this can be achieved please. I want to place the “sell order” at the end of the day provided the current price is above yesterday’s close. I am intending to trade the daily chart.
Dymjohn
07/17/2018 at 12:02 PM #7613007/17/2018 at 12:15 PM #76133thanks Vonasi
Is there no way of placing an order to open at the end of the day whilst Auto trading on daily charts? My thoughts were that when a setup occurs in volatile markets you don’t want to wait until the open of the next day when there is likely to be a large gap in price.
07/17/2018 at 12:23 PM #76135All decisions are made at the close of a candle so the only way to enter part way through a day is to trade a shorter time frame chart or place stop and limit orders at the previous candles close. On a daily chart nothing can be changed or decided until the days candle has closed. Multi Time Frame is being trialled at the moment and might help you get closer to what you want to do. It should be available for testing on IG/PRT Demo accounts tomorrow hopefully.
1 user thanked author for this post.
08/05/2018 at 7:45 PM #7758508/05/2018 at 8:40 PM #77586Not on a daily time frame as there is only one time for a daily candle. If you switch to faster time frames then you can stop trading at any time that is represented by a candle on the chart. So hourly chart means you can stop trading or close positions at 2100, 2200, 2300 etc On a 30 minute chart 2100, 2130, 2200, 2230, 2300 are all available. Switch to a 1 minute chart and 2159 becomes available.
As I mentioned MTF which is being tested in demo at the moment will allow you to do this – you can make trading decisions on a daily chart and then close positions at 2159 on a minute chart.
DEFPARAM FLATAFTER will close all positions but only if a candle with the time you specify exists on the chart you are trading on.
1 user thanked author for this post.
08/05/2018 at 11:24 PM #775881234567891011DEFPARAM CumulateOrders = False // Cumulating positions deactivated// Setting Time Framework//startTradingnoEntryBeforeTime = 143000timeEnterBefore = time >= noEntryBeforeTime// endTradingnoEntryAfterTime = 213000timeEnterAfter = time < noEntryAfterTime//Close all PositionsDefParam FlatAfter = 211500Hi Vonasi,
Your reply really cleared things up.
I am trading on a 15 minute timeframe and have been using the following code. However the algo is still creating orders at 15:30 on one day and not closing them till 14:50 the next day. I believe I am using the DEFPARAM FLATAFTER function correctly but if I am not would love some guidance.
Kind Regards,
Simone
08/06/2018 at 7:32 AM #77604The code looks fine for a fifteen minute chart. The only suggestion would be to move the DEFPARAM FLATAFTER to the beginning of the code. I don’t know whether this is the problem or whether PRT cares about the location but I have always seen all the DEFPARAM’s as the first lines of code before rather than buried in the code.
08/06/2018 at 4:07 PM #7765908/06/2018 at 4:12 PM #77660All DEFPARAM must be at the beginning of the code, otherwise ProBacktest will throw errors.
Thanks for confirming that Nicolas. Something in the back of my mind told me that that was the case. Maybe the documentation should be updated to show this?
-
AuthorPosts
Find exclusive trading pro-tools on