Inside Bar Break with stop loss and target


Category:
0
0

I use a simple strategy where in an uptrend if an inside bar appears I buy the break of the top of that bar on the next candle.  I then put my stop loss at the bottom of the inside bar and create a price target equal to the size of the inside bar above the break.  I have tried to build this but struggle with 2 parts.  First getting the buy to trigger immediately on the break and not waiting until this occurs and then buying on the next candle.  Second, getting TOS to somehow calculate the stop loss and price target automatically based on that inside bar.

I really want to build the strategy so that I can back-test with others factors to see if I can improve my results.

Is any of this possible in TOS?

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on February 2, 2020 8:15 am
151 views
0
Private answer

You did not provide your code so I cannot take the time to help you understand where you went wrong. Strategies are very complex tools to construct. So I have very limited time in which to provide a fully functional solution. I do not have time to implement the full breadth of elements you requested. I have to respect my client who have already paid me to created less complex solutions than what you have requested.

The code below includes two of the elements in a such a way that it should help you understand where your attempts were falling short of your goals.

def insideBar = high < high[1] and low > low[1];
def triggerBuy = insideBar[1] and high > high[1];
AddOrder(OrderType.BUY_TO_OPEN, triggerBuy[-1], high);
def triggerExit = insideBar[1] and low < low[1];
AddOrder(OrderType.SELL_TO_CLOSE, triggerExit[-1], low);

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on February 2, 2020 9:53 am
0
Thanks you so much, very helpful. Sorry i did not provide my code as every time I built it I quickly scratched with disappointment. What you provided already solved some problems. I guess the only thing I need help with now is the targeted sell. If the inside bar has a range of $3 from bottom of wick to top, I set my exit $3 above the entry. This makes it a 1:1 risk reward ratio for me. Is this an easy code or more difficult of a question to answer here? I would be happy to pay for additional service if I can get this right. Thank you again!
( at February 2, 2020 10:14 am)
0
Our professional services are explained here: https://www.hahn-tech.com/about/
( at February 2, 2020 5:34 pm)