Order Entry n Candles after Trigger
Forums › ProRealTime English forum › ProOrder support › Order Entry n Candles after Trigger
- This topic has 6 replies, 3 voices, and was last updated 5 years ago by Welshtrader.
-
-
10/19/2018 at 10:07 PM #83200
Hi all,
I’m just getting started with Prorealtime coding, so apologies up front if this is a noddy question. I have a basic strategy I’m trying to set up for testing.
The idea is to catch a pullback into a trend (downtrend in the example here, but inverse would apply for uptrend) by identifying a candle which pushes up though a descending EMA but closes below, and using this as a trigger from which to place an order. As an example, a short entry 3 points below the lowest Low of the 5 candles preceding the Trigger candle. I’ve managed to get as far as identifying the Trigger candle and coding an entry which works provided the candle immediately following the Trigger candle hits the entry price, but if I’m understanding correctly, the order effectively dies if not hit by this next candle. I want to keep the order valid until hit, or cancelled by an intervening close above an EMA. Hopefully the attached image illustrates.
Any pointers greatly appreciated.
Regards
WT
10/19/2018 at 10:12 PM #8320110/20/2018 at 9:52 AM #83223Easiest way to get an answer is to post your code thus far (using the Insert PRT Code on the toolbar above each new post).
Are you using the Select File button below each new post to (try) and attach an image?
1 user thanked author for this post.
10/20/2018 at 2:25 PM #83227Just set a flag to keep putting the order on the market until you no longer want to: Something like:
1234567891011if not onmarket and (your signal candle conditions) thenflag = 1endifif flag and not onmarket thensellshort 1 contract at (my price) stopendifif onmarket or (your stop placing orders condition) thenflag = 0endifNot tested.
1 user thanked author for this post.
10/20/2018 at 3:47 PM #83234Thanks for the replies both, I’ll have a play around and see what I can do. Is it the case then that if I assign a variable a value, that value is ‘remembered’ beyond the next candle? Is it just the Order that gets forgotten?
Re. the image yeah I tried the Select File thing… In fact I’ll try it again here now…
10/20/2018 at 4:02 PM #83237Variable values are remembered candle to candle. You can use the instruction ONCE before assigning a variable value and this means that that value is only set on the very first run through the code and not on subsequent candles.
Limit and stop orders last for just one candle.
Your image is very clear and should be easy to code. Often the best way to code is to write down what you want in clearly defined steps and often you will find that the code is not far off what you have written down so you are half way there already.
I think it is best if you have a crack at it yourself and ask any questions that crop as you will learn so much more doing it that way.
1 user thanked author for this post.
10/22/2018 at 10:45 AM #83316Absolutely, thanks very much for the response. Will have a go over the next few days.
cheers,
WT
-
AuthorPosts
Find exclusive trading pro-tools on