Portfolio Trader 'End of Day' Print Code  [SOLVED]

Questions about MultiCharts and user contributed studies.
aconnery
Posts: 32
Joined: 21 Apr 2013
Has thanked: 9 times
Been thanked: 4 times

Portfolio Trader 'End of Day' Print Code

Postby aconnery » 14 Sep 2022

I sometimes use Portfolio Trader to create an output CSV file which I can use externally.

I use the following code ....... if(date <> LastCalcDate) then #return; ....... On daily bars this means if the date is not the calculation date (i.e. the session has ended and it is now allowable to calculate today) then no action should be taken (e.g. no print)

This will ensure that the CSV file is not updated / printed for every date in the sequence. However, If I use this code on say 30 minute bars, then it goes on a loop and prints every symbol in order multiple times, because the Date is the LastCalcDate for each bar of the day. I only want to print once at the end of each day.

Does anyone have any suggestions how this might be worked for intraday data when the last bar is the only output required ?

Thanks in advance

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: Portfolio Trader 'End of Day' Print Code

Postby rrams » 14 Sep 2022

Code: Select all

if SessionLastBar then print("end of session");

aconnery
Posts: 32
Joined: 21 Apr 2013
Has thanked: 9 times
Been thanked: 4 times

Re: Portfolio Trader 'End of Day' Print Code  [SOLVED]

Postby aconnery » 15 Sep 2022

Thanks !!


Return to “MultiCharts”