Anyway to calculate indicator reversely to the price?

 

I have a request, that to use the indicator functions in the reverse direction of what it should be. For eg.


'I want to place a buy limit order where iRSI(14) = 20. Currently, the RSI is above 20. What is the price I should place it on?'

'I want to place the stop loss value where MACD signal line passes beyond value bar. What is the price for SL?'

'The close price on day 7 was so unexpected that it ruined the whole RSI. What should be the maximum close price for that day, so that non of the recent days RSI goes beyond 80?'


Is there any method within MQL scope, by either some calculation or iteration, to achieve these goals? I think the major thing is to conjure a close price, which is differ to the actual one, to make it work. But how?

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Requests to execute trade operations are formalized as orders. Each order has a variety of properties for reading. Information on them can be obtained using functions Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The...
 
a4194304: 'I want to place a buy limit order where iRSI(14) = 20. Currently, the RSI is above 20. What is the price I should place it on?'
  1. Doubles are rarely equal. Understand the links in:
              The == operand. - MQL4 programming forum
  2. Some indicators, you can reverse engineer them, like the RSI. You can do a binary search of prices, passed to the RSI code as a function, to find your 20.
  3. Other indicators like ADX will reach a minimum and then increase, so you must be careful to avoid an infinite loop.
  4. There is a company does sells some of these reverse engineered indicators, search Linnsoft.
  5. Stop thinking like a human and think like an EA. Wait for the RSI to cross the 20/80 line, and then just open/close.


 
William Roeder:
My reversed RSI levels indicator
          How to predict RSI Level??? - Price Chart - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 2 #11 2020.06.12