How take indicator value exactly at OrderSend moment, MT4

 

Please coders, help, Im not so experienced in MT4 coding.

I wont to take and show in EA, RSI value at moment of opening ticket, OrderSend.

My EA opens tickets in RSI range 30-70, but I need to know RSI value exactly in OrderSend moment and show that value in Chart for analysing and optimising.

 
use the mt4 function iRSI() and call this function and save the returned value at the moment right before you send the order and then show it using Comment().
iRSI - Technical Indicators - MQL4 Reference
iRSI - Technical Indicators - MQL4 Reference
  • docs.mql4.com
iRSI - Technical Indicators - MQL4 Reference
 
Carl Schreiber:
use the mt4 function iRSI() and call this function and save the returned value at the moment right before you send the order and then show it using Comment().


Thanks for fast answer but need some details.

Is it void funtion?  I tried with    void rsival(double=iRSI(Symbol(),0,14,PRICE_CLOSE,0));   not possible on global scope.

How to save?

 

Now function is ok, no errors

 void Rsival()

 {double rsi=iRSI(Symbol(),PERIOD_M15,14,PRICE_CLOSE,0);}


How to save? I can not find any Save  function except FileSave

 

You can print it to journal then it will be saved in the log file (with timestamp) or you can use globals then it will be saved for 4 weeks etc. https://www.mql5.com/en/docs/globals 

Many ways to do it you can also create double array [] to store it but it will be a bit more sensitive to be lost upon re-init and re-start's etc.

The write to file is actually a solid one because then it will be saved in stead of being held in memory only...

Documentation on MQL5: Global Variables of the Terminal
Documentation on MQL5: Global Variables of the Terminal
  • www.mql5.com
Global Variables of the Terminal - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: