Hi, I’m working on prototyping a new indicator but I don’t know how to code it. I have tried multiple times but only attempt that got close wasn’t good enough.
My indicator involves the following;
Measuring the % distance between a candles high to low(low to high) within a 5 minute timeframe, with a 2 hour time limit. A position should then be opened if stock price reaches 50% of the previous % difference
(9:00am) stock price at high of 5 minute candle is 10
(9:30am) stock price at low of 5 minture candle is 9.9
% difference between 10 and 9.9 is -1%, which is past the minimum of 1%
% difference between 10 and 9.9 is -1%, therefore buy point is at 9.95 (+0.5%, since 10 – 0.5% = 9.95)
(10:00am) stock price meets buy point at 9.95, long position is opened.
(9:00am) stock price at low of 5 minute candle is 10
(9:30am) stock price at high of 5 minture candle is 10.2
% difference between 10 and 10.1 is +1.9%, which is past the minimum of 1%
% difference between 10 and 10.1 is +1.9%, therefore buy point is at 10.1 (-0.5%) since: 10.2 – (1.9%/2) = 10.1)
(10:00am) stock price meets buy point at 10.1, short position is opened since process took under 2 hours (start at 9:00am ends at 10:00am)
Hope this is clear.
Any help will be greatly appreciated. I have tried to code this myself many times using some knowledge I found on this forum but can’t get it to work properly. I used ‘summation’ repeated 14 times on 5 mintue timeframe which doesn’t seem like a good way of doing this. I wouldn’t be asking for help on this forum if I hadn’t already tried this myself already.
Warning: Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced clients who have sufficient financial means to bear such risk. The articles, codes and content on this website only contain general information. They are not personal or investment advice nor a solicitation to buy or sell any financial instrument. Each investor must make their own judgement about the appropriateness of trading a financial instrument to their own financial, fiscal and legal situation.