Hello everyone!
I'm trying to make an offline chart generating indicator for basket trading. In the basket trading method there would be pairs that are buyed and pairs that are sold. There are indicators already out there, that can generate offline charts from a basket of pairs, but they count all the pairs in it as being "buy" pairs. They're simply adding the price data of the basket pairs' together. I need one that reverse the data on the short pairs, since when they going down that's good for us, so I want to see that on my offline chart as an up move.
I found a chart reversing indicator on mql4.com and it's using a simple 1/x formula to reverse the chart. I've modded it to use substraction instead and it's worked good. I need to use a big number to substract from, so the price cannot go into negative, but that's not a problem since I don't care about the actual price, and the pip amount, price action, candle formations are there with this method too.
Now I trying to make the indicator that have two arrays of symbols, one for the buy pairs and one for the sell pairs. I add the buy arrays price datas together, and substract the sell arrays datas from each other. Then I add these two summarized array values together to get the combined price.
The weird part is that when I enter only Buy pairs into the input field, then the indicator generates the offline chart pefectly without any errors. If I enter only sell pairs then the chart won't open ("waiting for update" text) and in the journal tab of mt4 there are error messages about it. If I enter buy and sell pairs, there is something in the offline chart that can be seen, but that's pretty weird, and there are error messages in the journal too. If I enter the same pair as sell and buy too, then the expected result is generated without errors - chart without any visible candles.
I don't know what is wrong with my code, I think it's logically correct. Can someone more experienced coder please look into it and tell me how can it be fixed to work?
Thanks in advance!
EDIT: I forgot to mention that you have to input the list of pairs as a comma separated list, using uppercase letters, and only the pairs name without any other characters the broker adds to the end of it.
I'm trying to make an offline chart generating indicator for basket trading. In the basket trading method there would be pairs that are buyed and pairs that are sold. There are indicators already out there, that can generate offline charts from a basket of pairs, but they count all the pairs in it as being "buy" pairs. They're simply adding the price data of the basket pairs' together. I need one that reverse the data on the short pairs, since when they going down that's good for us, so I want to see that on my offline chart as an up move.
I found a chart reversing indicator on mql4.com and it's using a simple 1/x formula to reverse the chart. I've modded it to use substraction instead and it's worked good. I need to use a big number to substract from, so the price cannot go into negative, but that's not a problem since I don't care about the actual price, and the pip amount, price action, candle formations are there with this method too.
Now I trying to make the indicator that have two arrays of symbols, one for the buy pairs and one for the sell pairs. I add the buy arrays price datas together, and substract the sell arrays datas from each other. Then I add these two summarized array values together to get the combined price.
The weird part is that when I enter only Buy pairs into the input field, then the indicator generates the offline chart pefectly without any errors. If I enter only sell pairs then the chart won't open ("waiting for update" text) and in the journal tab of mt4 there are error messages about it. If I enter buy and sell pairs, there is something in the offline chart that can be seen, but that's pretty weird, and there are error messages in the journal too. If I enter the same pair as sell and buy too, then the expected result is generated without errors - chart without any visible candles.
I don't know what is wrong with my code, I think it's logically correct. Can someone more experienced coder please look into it and tell me how can it be fixed to work?
Thanks in advance!
EDIT: I forgot to mention that you have to input the list of pairs as a comma separated list, using uppercase letters, and only the pairs name without any other characters the broker adds to the end of it.
Attached File(s)