target profit moving average
Forums › ProRealTime English forum › ProOrder support › target profit moving average
- This topic has 6 replies, 5 voices, and was last updated 1 year ago by robertogozzi.
-
-
04/09/2023 at 10:18 PM #21305904/10/2023 at 3:44 AM #21306004/12/2023 at 11:28 AM #213175
Just a follow up question; how do I do partial closure?
For example two different close positions based on two different moving averages. I have the below code but not sure how to add that
1*atr closes when it reaches 50 moving average
and then the remaining (1*atr) closes when price touches 100 moving average
also, if i wanted to bring the stop loss up to breakeven when it touches for example the 50 moving average, how could i code this?
Any help would be much much appreciated
123456789atr= averagetruerange[12](close)ma1=average[50]ma2=average[100]IF Bullish0 THENbuy (200/(2*atr)) perpoint AT MARKETset stop loss (2*atr)set target price (ma1)ENDIF04/12/2023 at 12:47 PM #213182for Breakeven you can maybe look at this page it will help you, and about selling at 2 level
for selling at 2 level of price maybe you can use 2 IF condition and Sell 1 shares when the condition it met
04/12/2023 at 1:00 PM #213184to close partially an order, nice example from Roberto: https://www.prorealcode.com/topic/replacing-tp-with-partial-close/#post-194694
to put order at breakeven (and many other possibilites) with these new instructions: New trading instructions: better management of your orders!
06/14/2023 at 10:14 PM #216237Hi, just wanted to follow up – based on the above formula – with targeting the moving average as a target price, it seems to execute at the moving average value directly correlating with opening candle of the trade. Is it possible to have the target price move with the moving average so its dynamic. So if the todays candle price touches the moving average it closes at that point. With the formula above, it doesnt seem to close, only when the price hits the initial moving average value that was calculated when the trade first opened. Its a bit difficult to explain – hope this makes sense.
06/15/2023 at 12:37 AM #216241Swap lines 8 and 9, so that set target price (ma1) is the last line, i.e. outside the conditionl block IF…ENDIF and will ALWAYS be executed, not just at entry time.
Be warned that ma1 might be lower than the prior candle, thus exiting at a lower price than originally set.
-
AuthorPosts
Find exclusive trading pro-tools on