I'm looking to create a simple strategy to better understand how to build strategies, as to date I have only built indicators. I was curious if someone could help me walk through how to create a dead simple strategy that I can then use to modify with other indicators.
So let's say that we want to create a strategy that uses four (4) 14 period Bollinger Bands ("BB"): an upper at 2, an upper inside at 1, a lower inside at -1 and a lower at -2, which we in turn could call BB2, BB1, BB-1 and BB-2, respectively.
1. Enters Long when price touches the BB-1 with a profit target ("PT") at BB2 and a stop at BB-2.
2. Enters Short when price touches the BB1 with a PT at BB-1 and a stop at BB2.
3. I do not want my PT and stop to be valid until the next bar (i.e., the entry bar is just an entry bar...nothing else).
4. I want to enter and exit with market orders.
So pretty a slow pitch BB strategy that I can then use to modify as necessary.
Here is my first crack at the Strategy wizard:
1. Name it
2. Create "Period" input of type int with a Default value of 14 (i.e., because we're using a BB with a period of 14)
3. Conditions and Actions:
-Set 1:
--When the following actions are true: "Close >= Bollinger(1, 14, Upper)" (BB1 is short entry)
--Do the following: EnterShort
-Set 2:
--When the following actions are true: "Close <= Bollinger(1, 14, Lower)" (BB-1 is long entry)
--Do the following: EnterLong
-Set 3:
--When the following actions are true: "Close <= Bollinger(2, 14, Lower)" (BB-2 is long PT)
--Do the following: ExitShort
-Set 4:
--When the following actions are true: "Close >= Bollinger(2, 14, Upper)" (BB2 is long PT)
--Do the following: ExitLong
-Set 5:
--When the following actions are true: "Close >= Bollinger(2, 14, Upper)" (BB2 is long stop)
--Do the following: ExitShort
-Set 6:
--When the following actions are true: "Close <= Bollinger(2, 14, Lower)" (BB-2 is short stop)
--Do the following: ExitLong
Here are my questions:
1. How do I make sure that a stop or PT is not triggered on the entry bar?
2. How do I use Strategy Analyzer to run a backtest on this?
Thanks!
Aventeren
Comment