Last day of month code working with data2 ;

Questions about MultiCharts and user contributed studies.
gioakino
Posts: 11
Joined: 11 Feb 2019

Last day of month code working with data2 ;

Postby gioakino » 02 Jun 2019

Hi everyone, i have this code that i use to find last day of month, it works fine but if the signal contains data2 it does not work, the error message is " Open Next bar type strategies calculation in not permitted on multiple DataStreams", someone has a suggestion to solve the problem and calculate correctly Last day of Month with data2 ?

Code: Select all

vars: lastTradingDay(false);

lastTradingDay = false;
If month(date of next bar) <> month(date) then begin
lastTradingDay = true;
end;

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Last day of month code working with data2 ;

Postby TJ » 02 Jun 2019

Please get a screenshot of the error message

gioakino
Posts: 11
Joined: 11 Feb 2019

Re: Last day of month code working with data2 ;

Postby gioakino » 02 Jun 2019

errore.jpg
(100.68 KiB) Downloaded 242 times

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Last day of month code working with data2 ;

Postby TJ » 03 Jun 2019

I have tried your code.
I do not get your error message.

Please post your complete code if you need help debugging.

gioakino
Posts: 11
Joined: 11 Feb 2019

Re: Last day of month code working with data2 ;

Postby gioakino » 04 Jun 2019

Hi TJ, this the complete code i'm using for create my montly custom report, as I told you it does not work if inserted in any signal with data2;

Code: Select all

///////////////////////MONTHLY OUTPUT vars: lastTradingDay(false),MontlyProfit(0); lastTradingDay = false; If month(date of next bar) > month(date) then begin lastTradingDay = true; end; If lastTradingDay then begin MontlyProfit= Netprofit; end; If lastTradingDay then FileAppend("C:\Users\utente\Desktop\outputMulticharts\ReportMensilePortafoglio.txt", symbol +" "+getstrategyname +" " +FormatDate("dd-MM-yyyy", DateToJulian(Date) )+" " + NumToStr(MontlyProfit,2)+ " " +NewLine);

gioakino
Posts: 11
Joined: 11 Feb 2019

Re: Last day of month code working with data2 ;

Postby gioakino » 06 Jun 2019

No one has any ideas how to solve ?


Return to “MultiCharts”