Dear Community members can any one help me to code below strategy:
Buy Rule:
1. Multiple open positions are allowed
2. Buy if price fell by Y% from the pervious open position any total number of open positions is not greate than z.
Sell Rule:
1. Sell if open position reach the profit target a% or position is 30 bars old
Thanks in advance :)
Size:
Color:
Hi Ashish,
You could do it in Rule wizard entirely but one key element is missing: the buy condition. How do you enter the first open position?
Size:
Color:
Hi Eugene,
Thanks for your response
Below is the updated strategy (Added first buy conndition as well).
Buy Rule:
1. Buy the first bar at close.
2. Buy if price fell by Y% from the pervious open position and total number of open positions is not greate than z.
3. Multiple open positions are allowed
Sell Rule:
1. Sell if open position reach the profit target a% or position is 30 bars old.
Thanks and Regards,
Ashish
Size:
Color:
Here you go.
If all positions are closed, strategy makes a reentry at the next day's close.
CODE:
Please log in to see this code.
Size:
Color:
Hi Eugene,
Thanks a lot for the code. Its working 90% as per my specification. I make a small change in my sell rule. Can you please help me with the code.
Sell Rule:
1. Sell if open position reach the profit target a% or Latest Open position is 30 bars old.
It will be great if you tell me the Entry and Exit conditions you use in "Rule wizard".
Size:
Color:
I'm not using Rules for this Strategy.
What is the difference between "open position" and "latest open position"?
Size:
Color: