Setting:
- 1 tick bar
- Dot on close bar
- [IOGMode(IOGMode.Enabled)]
Background:
I have a bool "buySignal" variable, long order will be sent if
1.buySignal is true and
2. -0.03 < percentage change is < 0.03 and
3.Bars.Close[0] != Bars.Close[1]
I have used "Output.WriteLine" to debug and try to see when these conditions become "true". However, I found out that even if all the above mentioned conditions are all "true", long order still did not send. I am so confused and not sure if it is my logical error or Multichart's system limitation.
I have attached the result ran on the Multichart and my codings.
****************
Question:
Why the first long order sent at 10:14? I think the first Bar.close[0]<Bar.close[1] already happened at around 9:33: (the dot lower than the previous dot) and all other conditions are already met, why long order did not send at that moment?
And I noticed that there are lot times that Bar.close[0]<Bar.close[1] and all other conditions are met, long order still did not send out.
Please advice it is my logical error, or system limitation?
Not sure why Multichart cannot follow my logic on the following coding
-
- Posts: 21
- Joined: 08 Mar 2021
- Been thanked: 1 time
Not sure why Multichart cannot follow my logic on the following coding
- Attachments
-
- Bars.JPG
- (101.57 KiB) Not downloaded yet
-
- Coding file.pln
- (3.18 KiB) Downloaded 122 times
-
- Posts: 21
- Joined: 08 Mar 2021
- Been thanked: 1 time
Re: Not sure why Multichart cannot follow my logic on the following coding
please help answer my question..im confused
- Vlada MultiCharts
- Posts: 293
- Joined: 22 Apr 2020
- Has thanked: 8 times
- Been thanked: 76 times
Re: Not sure why Multichart cannot follow my logic on the following coding
Hello lewisthegood,
When you use buy next bar, the order will be sent on the next bar after the bar meeting the specified condition is plotted.
It is also required to take into consideration the BarsBack value. If you need to start the calculation of the strategy earlier, you can set BarsBack = 1 instead of 50.
To avoid a 1-bar delay, you can transfer the calculation to the bar open.
You can do this by calling the method
or
in the CalcBar function.
You can refer to the code of a pre-built signal Volty_Expan_Open_LE to check the example of how to transfer the calculation to the bar open.
When you use buy next bar, the order will be sent on the next bar after the bar meeting the specified condition is plotted.
It is also required to take into consideration the BarsBack value. If you need to start the calculation of the strategy earlier, you can set BarsBack = 1 instead of 50.
To avoid a 1-bar delay, you can transfer the calculation to the bar open.
You can do this by calling the method
Code: Select all
Bars.OpenNextBar()
Code: Select all
Bars.TimeNextBar()
You can refer to the code of a pre-built signal Volty_Expan_Open_LE to check the example of how to transfer the calculation to the bar open.
-
- Posts: 21
- Joined: 08 Mar 2021
- Been thanked: 1 time
Re: Not sure why Multichart cannot follow my logic on the following coding
1, But I’m using 1 tick chart, bar open and close should be the same? And Bars.OpenNextBar() means buy at the open of next bar ?
2, if I set bars back =1 , I cannot use the bar data more than 1..?
2, if I set bars back =1 , I cannot use the bar data more than 1..?
- Vlada MultiCharts
- Posts: 293
- Joined: 22 Apr 2020
- Has thanked: 8 times
- Been thanked: 76 times
Re: Not sure why Multichart cannot follow my logic on the following coding
Hi lewisthegood,
1. You can check this guide for more info.
2. If you do not need the calculation to be performed on 50 bars, you can set 1 bar. This means that the study will be calculated on one bar. We believe it shall be enough for the code you provided.
1. You can check this guide for more info.
2. If you do not need the calculation to be performed on 50 bars, you can set 1 bar. This means that the study will be calculated on one bar. We believe it shall be enough for the code you provided.