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?
how do I get next bar month?
-
- Posts: 83
- Joined: 18 Mar 2013
- Has thanked: 11 times
Re: how do I get next bar month?
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
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
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: how do I get next bar month?
This is not true. We provided you with an example of script that should be helpful to reach your goal. It is attached.I have spend 1.5 hrs in chat room without any solution.
- Attachments
-
- Test_Month.pln
- (1.87 KiB) Downloaded 498 times
-
- Posts: 83
- Joined: 18 Mar 2013
- Has thanked: 11 times
Re: how do I get next bar month?
Yes, sadly this message was posted around 20 minutes before you send me the solution. You can lock or delete it.
-
- Posts: 83
- Joined: 18 Mar 2013
- Has thanked: 11 times
Re: how do I get next bar month?
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?
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?
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: how do I get next bar month?
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.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?
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: how do I get next bar month?
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.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?