MA cross, buy trigger
Forums › ProRealTime English forum › ProOrder support › MA cross, buy trigger
- This topic has 9 replies, 4 voices, and was last updated 8 years ago by traderollie.
-
-
04/08/2016 at 5:33 AM #5053
Salut,
Say I have an MA plotted on the price chart, and the price is currently sitting under the MA.
I want to buy when the MA is touched, but I don’t want to buy at next open… I want to buy at the price of the MA on that same bar. Is this possible to code please?
Many thanks.
04/08/2016 at 9:05 AM #5060Hi, not exactly because the system always wait until the current bar is finished to open a new position.
But you can still open a position in the next candle at the same price where the last bar was touched with a LIMIT order.
12345678REM Moving Averagemm = Average[x](close) // x = periods of ma// buy = your conditions to go inIF NOT LongOnMarket AND buy = 1 THENBUY 1 CONTRACT AT mm[1] LIMITENDIFHope it helps you.
04/08/2016 at 9:29 AM #5071Hello, if the price is “currently sitting under the MA”, the pending order would be a STOP one and not a LIMIT one, or I miss something here.. sorry got a cold.. 😐
Thank you very much Adolfo for helping people around here!!!
04/08/2016 at 9:55 AM #507804/08/2016 at 10:10 AM #5079Adolfo, PRT finds an error on this line. Unfortunately I’m very new to coding this platform…
IF NOT LongOnMarket AND BUY=1 THEN
Thank you.
PS price is touches on a price above the current price, so yes Nicolas that’s right, probably a STOP order.
04/08/2016 at 10:21 AM #508004/08/2016 at 10:36 AM #508304/08/2016 at 10:43 AM #5084Then should be something like this, but it will always buy when it occours.
12345678REM Moving Averagemm = Average[x](close) // x = define MA periods you want to use// Your conditions to buy// You are not in, and price was under MAIF NOT LongOnMarket AND High<mm THENBUY 1 CONTRACT AT mm STOPENDIFLet me know if works for you!
04/08/2016 at 11:15 AM #508809/29/2016 at 9:16 PM #13937This is something similar to what I need, Where do I put this in my current code?
-
AuthorPosts
Find exclusive trading pro-tools on