Print Command in Real-Time Trading & NOT during backtesting  [SOLVED]

Questions about MultiCharts and user contributed studies.
Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Print Command in Real-Time Trading & NOT during backtesting

Postby Adrian Uncle » 28 Sep 2016

Hi there,

I have this print command that I want to produce an output only during live trading and not during backtesting. Any suggestions are greatly appreciated.

If (backtesting = false) then Print(" Date ", FormatDate("yyyy-MM-dd", ELDateToDateTime(Date)))

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Print Command in Real-Time Trading & NOT during backtest

Postby JoshM » 28 Sep 2016

I have this print command that I want to produce an output only during live trading and not during backtesting. Any suggestions are greatly appreciated.

If (backtesting = false) then Print(" Date ", FormatDate("yyyy-MM-dd", ELDateToDateTime(Date)))
You can use the `GetAppInfo()` keyword for that. When used with the `aiRealTimeCalc` value between its parentheses, that keyword returns 1 when the script calculates on real-time data (thus live trading) and a value of 0 otherwise (when backtesting).

For example:

Code: Select all

if (GetAppInfo(aiRealTimeCalc) = 1) then begin

Print(" Date ", FormatDate("yyyy-MM-dd", ELDateToDateTime(Date)));

end;

Adrian Uncle
Posts: 66
Joined: 26 Nov 2015
Has thanked: 7 times
Been thanked: 3 times

Re: Print Command in Real-Time Trading & NOT during backtest  [SOLVED]

Postby Adrian Uncle » 29 Sep 2016

Josh,

You are awesome. Thank YOU!


Return to “MultiCharts”