print to file bars back?

Questions about MultiCharts and user contributed studies.
Posts: 31
Joined: 26 Aug 2009
Location: London

print to file bars back?

Postby Dug » 31 Aug 2009

Hello, can anyone help or offer advice for a problem i have encountered?
I wish to export data (OHLC) plus any trades that are executed during a signal test on a i use....

print(File(FileName+getsymbolname +".txt"),datetojulian(date),",",open,",",high,",",low,",",close,",",AvgTrueRange(20),",",marketposition - ETC; ETC:);

The problem I get is that when applying this to a very simple signal to different charts/instruments that it starts writing the text file from different dates?

the maxbarsback referenced is 25. Some textfiles start writing at this early date. Others, and seemingly randomly so, start later. eg; 2-Jan 2003

All the charts/data start and end from the same dates...19 Aug 2002 - 21 Aug 2009.

What seems to be happening is that the text file start date only occurs when the signal initially triggers.
Is there a way to record ALL the data from start to finish as a text file?

Posts: 2016
Joined: 21 Jul 2007
Has thanked: 171 times
Been thanked: 402 times

Postby bowlesj3 » 31 Aug 2009

You say "during a signal test" and that implies that the print is only executed within an IF test of some sort. That can be the only reason I figure. I would just move the print statement around a bit until it becomes clear as to what is restricting it and why.

Posts: 31
Joined: 26 Aug 2009
Location: London

Postby Dug » 01 Sep 2009

thanks for the response...
it probably is that, when its applied in a signal test it only starts printing when a signal is triggered, as opposed to an indicator that prints once the max bars back is reached.
The script is pretty small, just a get long on 20 high day break, sell out when ATR trailing stop is triggered. I am trying to get a feel on how the system works as i am relatively new to programming. So moving it around does not make much difference.

Basically ... given the bugs talked about in the portfolio testing re drawdowns, and the fact that we have our own excel based system (very slow...unfortunately) to test things, what i wanted to do was export the OHLC for each day and then on the same line as them in the text file, any triggers, and other info in a strategy. That way in excel you can really analyse what ever you want. Unfortunatley (unless i have missed something) the performance reports only show the trades and the dates they occur, not a full explanation. And you cant export from the charts trade signals and dates....

Posts: 31
Joined: 26 Aug 2009
Location: London

Postby Dug » 02 Sep 2009

For future reference....
I think it must have had something to do with maxbarsback setting.
I went through and reset every chart as having the same maxbarsback settings, and then rechecked every text file that was written.
Then it worked.
So in summary for any one else who might encounter such an issue, check the max bars back setting on the properties section of each instrument.
That seems to be the only thing i changed and made standard for all charts that made a difference.

On that do i set the max bars back setting in a signal or indicator so that it will be the same for every chart?

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times

Postby Andrew Kirillov » 16 Sep 2009

Dear Dug,

how do i set the max bars back setting in a signal or indicator so that it will be the same for every chart?

You may set this number for each indicator in PL Editor.

Unfortunately there is no way to do it for signals.

Return to “MultiCharts”