Tarea técnica
I've created my own indicator of horizontal stop loss and take profit lines. I use it with a hedging strategy on three periods of EURJPY, though the indicator should work with any combination of symbols. I call the lines risk and reward lines (RR Lines) in the code. The indicator is working well, though the code could likely be refracted and reduced/simplified. I'm trying to convert it into classes for use with the MQL5 wizard so I can make an EA that uses the RR Lines. I'd like help with three things:
- My programming skills are at the hobby level. Look over my indicators to make sure I'm doing it right. There may be errors or you may know of easy ways to make it better, more reliable and standard.
- Implement indicator using classes so it functions the same but with more organization and clarity, and so it can be used with the MQL5 Wizard. For example defining a CLine object with lineValue, lineType, lineColor, lineStyle, and then CRRLines with CLine risk1, reward1, reward2, reward3, centerLine, symbol, period, atr, atr period, other inputs, or whatever. I don't know how to implement this part very well.
- I will also need the signal code. I use the lines to generate a sell signal like this: for a long position, if the bid price crosses the risk (bottom) line, close the position. If the bid price crosses above the reward1 line and then falls back below it, close the position and take the profit. Same for reward2. If the bid price crosses the reward3 line, the whole indicator shifts up and we start over from the center line. For a short position, if the ask price crosses the risk (top) line, close the position. If the ask prices crosses below the reward1 line and then crosses back above it, close the position...and just the opposite of long position for the rest but using the ask price.
Kindly,
Keegan
Note: CRRLines - calculates the lines based on symbol and period. I don't add it to any charts. RRLines combines the lines from three different periods for comparison of risk and to recommend lot size. I add this one to the main window of each chart.