The following code is a swing strategy which buys upon price retracement to the 20-day EMA. I want to sell at a limit when the price crosses the upper BBandUpper2. The way it is currently constructed, the "sell at market" exits the position at the open of that bar. How can I construct the strategy code to "sell at limit" upon the cross of the BBandUpper2? Thanks for your help.
CODE:
Please log in to see this code.
Size:
Color:
CODE tags please.
Size:
Color:
Not sure what a code tag is. Here is the entire program. Let me know what else you need. Thanks.
CODE:
Please log in to see this code.
Size:
Color:
Bio, the next time you post, take a look at the 7 buttons right above where you're writing. Click on the one that says "CODE" and paste your code in between.
Size:
Color:
QUOTE:
How can I construct the strategy code to "sell at limit" upon the cross of the BBandUpper2? T
If OP talks about selling with AtLimit order when prices cross the Upper Bollinger Band intra-bar, then I'm math-disabled to know how to reverse-engineer BBs to find out the target price.
Size:
Color:
Thanks, Cone.
The code doesn't have to be a limit order. I'm just looking to sell at the point the price crosses the upper BB for back-testing purposes. In a real trade, I would probably place a limit order on a daily basis. I just need to know how well the strategy will work. It works well as is, and selling at the open of a day in which the price later crosses the upper BB would be a conservative, albeit impossible, assumption. The limit price would generally be higher than the daily open in this case. In the case of a gap above the target price, the limit would trigger at the open.
Size:
Color: