For example, Data1 with 1 minute resolution and let say indiciator MACD(5, 34, 5) and Data2 with 5 miniute resolution with indicator MACD(5, 34, 5). When I set the MaxBarBack Reference to 6 or something like that, then the autotrade entry will depend on the Data2's 5min resolution signal, however, the autotrade won't start until like over 100 bar of 1 minute bars in which is really what I don't want. As after 35 bars of 1 min bar, the 5min MACD would start plotting the graph base on the calculation, then how come we can't start using the 5 min MACD plotting as an entry for the autotrade and would instead wait until over 100 bars of 1 min bar to get the strategy started.
Am I missing something over the setting. Thanks
Problem with maxbarback with different data resolution [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: Problem with maxbarback with different data resolution
Hello Henrywl,
Please attach screenshots demonstrating this behavior and explain in details what the problem is exactly. How are indicator and strategy calculations connected in your case ?
If you are using a custom strategy code-please attach it to your post as well as the workspace you are using.
Please attach screenshots demonstrating this behavior and explain in details what the problem is exactly. How are indicator and strategy calculations connected in your case ?
If you are using a custom strategy code-please attach it to your post as well as the workspace you are using.
Re: Problem with maxbarback with different data resolution
The autotrade execution just won't start.
var0 = MACD( Close of Data2, FastLength, SlowLength ) Data2;
var1 = XAverage( var0, MACDLength ) Data2;
var2 = var0 - var1 ;
condition3 = var2 > 0;
if condition3 then
begin
if marketposition_checked(0) <> 1 then
Buy ( "LE(1)" ) Next bar AT Market;
end
else
begin
if marketposition_checked(0) <> -1 then
Sell Short ( "SE(1)" ) Next bar At Market;
end;
As I suppose the code should start execution as long as the MACD for the 5 min chart start collecting data, however, it doesn't even I keep on change the max reference bar back
var0 = MACD( Close of Data2, FastLength, SlowLength ) Data2;
var1 = XAverage( var0, MACDLength ) Data2;
var2 = var0 - var1 ;
condition3 = var2 > 0;
if condition3 then
begin
if marketposition_checked(0) <> 1 then
Buy ( "LE(1)" ) Next bar AT Market;
end
else
begin
if marketposition_checked(0) <> -1 then
Sell Short ( "SE(1)" ) Next bar At Market;
end;
As I suppose the code should start execution as long as the MACD for the 5 min chart start collecting data, however, it doesn't even I keep on change the max reference bar back
- Attachments
-
- Capture_1452.jpg
- strategy property
- (42.01 KiB) Downloaded 620 times
-
- Capture_1451.jpg
- workspace
- (191.58 KiB) Downloaded 611 times
-
- Capture_1450.jpg
- error message
- (74.66 KiB) Downloaded 614 times
Problem with BarBack Reference
Problem as attached error message!!
Data1 with 1 minute resolution and indiciator MACD(5, 34, 5) and Data2 with 5 miniute resolution with indicator MACD(5, 34, 5). When I set the MaxBarBack Reference to 6 or something like that, then the strategy entry will depend on the Data2's 5min resolution signal, however, the autotrade won't start until like over 100 bar of 1 minute bars in which is really what I intended. As after 35 bars of 1 min bar, the 5min MACD (Data2 5min) would start plotting the graph base on the calculation, then how come we can't start using the 5 min MACD plotting as an entry for the autotrade and would instead wait until over 100 bars of 1 min bar to get the strategy started.
The autotrade execution just won't start.
As I suppose the code should start execution as long as the MACD for the 5 min chart start collecting data, however, it doesn't and even I keep on change the max reference bar back
Data1 with 1 minute resolution and indiciator MACD(5, 34, 5) and Data2 with 5 miniute resolution with indicator MACD(5, 34, 5). When I set the MaxBarBack Reference to 6 or something like that, then the strategy entry will depend on the Data2's 5min resolution signal, however, the autotrade won't start until like over 100 bar of 1 minute bars in which is really what I intended. As after 35 bars of 1 min bar, the 5min MACD (Data2 5min) would start plotting the graph base on the calculation, then how come we can't start using the 5 min MACD plotting as an entry for the autotrade and would instead wait until over 100 bars of 1 min bar to get the strategy started.
The autotrade execution just won't start.
Code: Select all
var0 = MACD( Close of Data2, FastLength, SlowLength ) Data2;
var1 = XAverage( var0, MACDLength ) Data2;
var2 = var0 - var1 ;
condition3 = var2 > 0;
if condition3 then
begin
if marketposition_checked(0) <> 1 then
Buy ( "LE(1)" ) Next bar AT Market;
end
else
begin
if marketposition_checked(0) <> -1 then
Sell Short ( "SE(1)" ) Next bar At Market;
end;
- Attachments
-
- Capture_1457.jpg
- Another error message
- (8.8 KiB) Downloaded 613 times
-
- Capture_1451.jpg
- WorkSpace
- (191.58 KiB) Downloaded 601 times
-
- Capture_1450.jpg
- error message
- (74.66 KiB) Downloaded 604 times
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Problem with BarBack Reference
see section on MaxBarsBackProblem as attached error message!!
Data1 with 1 minute resolution and indiciator MACD(5, 34, 5) and Data2 with 5 miniute resolution with indicator MACD(5, 34, 5). When I set the MaxBarBack Reference to 6 or something like that, then the strategy entry will depend on the Data2's 5min resolution signal, however, the autotrade won't start until like over 100 bar of 1 minute bars in which is really what I intended. As after 35 bars of 1 min bar, the 5min MACD (Data2 5min) would start plotting the graph base on the calculation, then how come we can't start using the 5 min MACD plotting as an entry for the autotrade and would instead wait until over 100 bars of 1 min bar to get the strategy started.
The autotrade execution just won't start.
var0 = MACD( Close of Data2, FastLength, SlowLength ) Data2;
var1 = XAverage( var0, MACDLength ) Data2;
var2 = var0 - var1 ;
condition3 = var2 > 0;
if condition3 then
begin
if marketposition_checked(0) <> 1 then
Buy ( "LE(1)" ) Next bar AT Market;
end
else
begin
if marketposition_checked(0) <> -1 then
Sell Short ( "SE(1)" ) Next bar At Market;
end;
As I suppose the code should start execution as long as the MACD for the 5 min chart start collecting data, however, it doesn't and even I keep on change the max reference bar back
https://www.multicharts.com/trading-sof ... ripts_Work
ps. Please use code tag when posting codes. It makes reading easier.
Highlight the codes you are about to post, then click on the
Code: Select all
button located at the top of the message window.
I have tagged your code for you in your post.
Re: Problem with BarBack Reference
Hello Tj,
I have read the MaxBarBack already.. but still doesn't help, I still don't know what's going on with the error message I attached. In the Code, I use MACD only.
However, without 2 data series and apply with MACD the maxbarback I can be use is 1.
Thanks.
I have read the MaxBarBack already.. but still doesn't help, I still don't know what's going on with the error message I attached. In the Code, I use MACD only.
However, without 2 data series and apply with MACD the maxbarback I can be use is 1.
Thanks.
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Problem with BarBack Reference
Why do you want to set the maxbarsback to 6?Hello Tj,
I have read the MaxBarBack already.. but still doesn't help, I still don't know what's going on with the error message I attached. In the Code, I use MACD only.
However, without 2 data series and apply with MACD the maxbarback I can be use is 1.
Thanks.
The number of bars required for 5 min MACD(5, 34, 5) on a 1 min chart:
34 + 5 = 39
39 times 5 (for the 1 min chart) = 195.
Re: Problem with BarBack Reference
Thx, I am kind of seeing the problem now, but I have one more question is that, at the same time, I am applying RSI(9) for the 1 min chart together with MACD(5, 34, 5) with the 5 min chart. By executing such strategy, I have to set the max bar back to 9 for the RSI, however, since RSI(9) for Data1(1 min) and MACD(5) for Data2(5 min) in the same signal, I intend to use MaxBarBack with 5 instead of 9, because the strategy won't start executed until after the 9th bar of the 5 min MACD chart, I would like to use the 5min MACD signal right after the 5th bar of the 5 min chart.Why do you want to set the maxbarsback to 6?Hello Tj,
I have read the MaxBarBack already.. but still doesn't help, I still don't know what's going on with the error message I attached. In the Code, I use MACD only.
However, without 2 data series and apply with MACD the maxbarback I can be use is 1.
Thanks.
The number of bars required for 5 min MACD(5, 34, 5) on a 1 min chart:
34 + 5 = 39
39 times 5 (for the 1 min chart) = 195.
RSI(9) of Data1 = start after 9 minute
MACD(5, 34, 5) of Data2 = 9x5 minute start after 45 minute instead of 5x5 minute
Seems the code couldn't distinguish between the different data resolution with the max bar back option.. since by default I assume the max bar back should use Data1's resolution as a default calculation.
Is there any otherway, I can work around it. Thank you.
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: Problem with BarBack Reference [SOLVED]
Maxbarsback applies to the indicator as a whole.Thx, I am kind of seeing the problem now, but I have one more question is that, at the same time, I am applying RSI(9) for the 1 min chart together with MACD(5, 34, 5) with the 5 min chart. By executing such strategy, I have to set the max bar back to 9 for the RSI, however, since RSI(9) for Data1(1 min) and MACD(5) for Data2(5 min) in the same signal, I intend to use MaxBarBack with 5 instead of 9, because the strategy won't start executed until after the 9th bar of the 5 min MACD chart, I would like to use the 5min MACD signal right after the 5th bar of the 5 min chart.
RSI(9) of Data1 = start after 9 minute
MACD(5, 34, 5) of Data2 = 9x5 minute start after 45 minute instead of 5x5 minute
Seems the code couldn't distinguish between the different data resolution with the max bar back option.. since by default I assume the max bar back should use Data1's resolution as a default calculation.
Is there any otherway, I can work around it. Thank you.
The minimum maxbarsback is the largest value of all the calculations of all the dataseries in that indicator.