how do I get next bar month?

Questions about MultiCharts .NET and user contributed studies.
maisatomai
Posts: 83
Joined: 18 Mar 2013
Has thanked: 11 times

how do I get next bar month?

Postby maisatomai » 25 Apr 2013

I want to get the month (e.g. Month=3 for march) for the next bar.

And this does not work.
int nextbarmonth=Bars.TimeNextBar.Month;

Anyone know how can I get it to work?

maisatomai
Posts: 83
Joined: 18 Mar 2013
Has thanked: 11 times

Re: how do I get next bar month?

Postby maisatomai » 25 Apr 2013

I have spend 1.5 hrs in chat room without any solution.

I just want to do a signal which buy on last day of the month.

int thisbar=Bars.CurrentBar;
int test=Bars.FullSymbolData.Time[thisbar+1].Month;
int test1=Bars.Time[0].Month;
if (test!=test1)
buy_order.Send();

This give me error

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: how do I get next bar month?

Postby Andrew MultiCharts » 25 Apr 2013

I have spend 1.5 hrs in chat room without any solution.
This is not true. We provided you with an example of script that should be helpful to reach your goal. It is attached.
Attachments
Test_Month.pln
(1.87 KiB) Downloaded 498 times

maisatomai
Posts: 83
Joined: 18 Mar 2013
Has thanked: 11 times

Re: how do I get next bar month?

Postby maisatomai » 25 Apr 2013

Yes, sadly this message was posted around 20 minutes before you send me the solution. You can lock or delete it.

maisatomai
Posts: 83
Joined: 18 Mar 2013
Has thanked: 11 times

Re: how do I get next bar month?

Postby maisatomai » 25 Apr 2013

Andrew MultiCharts is very helpful. I apologize if this thread causes you any distress.

I have a problem. If the year has 29th June, 30 June, 1 July, and if I use time[-1] to know whether month has changed, the earliest I can buy is on 30 June. However, I want my program to buy on 29th June. Is it possible to look ahead 2 bars?

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: how do I get next bar month?

Postby Andrew MultiCharts » 25 Apr 2013

Andrew MultiCharts is very helpful. I apologize if this thread causes you any distress.

I have a problem. If the year has 29th June, 30 June, 1 July, and if I use time[-1] to know whether month has changed, the earliest I can buy is on 30 June. However, I want my program to buy on 29th June. Is it possible to look ahead 2 bars?
Thank you for kind words. Unfortunately the "time[-2]" will not work. I'll consult with engineers and let you know if there is a workaround for you.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: how do I get next bar month?

Postby Andrew MultiCharts » 29 Apr 2013

I have a problem. If the year has 29th June, 30 June, 1 July, and if I use time[-1] to know whether month has changed, the earliest I can buy is on 30 June. However, I want my program to buy on 29th June. Is it possible to look ahead 2 bars?
It is possible with Bars.FullSymbolData, but at the moment it doesn't work properly. Should be fixed in coming MultiCharts .NET 8.7 beta 1.


Return to “MultiCharts .NET”