[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 333
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm not going to argue! If you try it, you'll see what's wrong. I'm just writing for those who will encounter this problem. It's reversed in time, so the chart is reversed in time. I'm posting the text of the indicator. RIGHT. Look at the chart very interesting inputs can be detected by it. It seems to me that it enters earlier and more accurately than MASD
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
double Buf_0[1000],Bears_array[1000],Bulls_array[1000],Line1[1000],Line2[1000];
int init()
{
SetIndexBuffer(0,Buf_0);
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
return;
}
extern double PeriodPower=13;
extern double MA_Period=5;
int start()
{
int i=Bars-IndicatorCounted()-1;
while(i>=0)
{
Bulls_array[i]=iBullsPower(NULL,0,PeriodPower,PRICE_CLOSE,i);
Bears_array[i]=iBearsPower(NULL,0,PeriodPower,PRICE_CLOSE,i);
ArraySetAsSeries(Bears_array,true); // Applied for synchronization of indexing in the iMAOnArray function
ArraySetAsSeries(Bulls_array,true);
Line1[i]=iMAOnArray(Bears_array,0,MA_Period,0,MODE_SMMA,i);
Line2[i]=iMAOnArray(Bulls_array,0,MA_Period,0,MODE_SMMA,i);
Buf_0[i]=(Line2[i]+Line1[i])/Point/10;
i--;
}
return;
}
I'm not going to argue! If you try it, you'll see what's wrong. I'm just writing for those who will encounter this problem. It's reversed in time, so the chart is reversed in time. I'm posting the text of the indicator. READY. Look at the chart very interesting inputs can be detected by it. It seems to me that it enters earlier and more accurately than MASD.
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
double Buf_0[1000],Bears_array[1000],Bulls_array[1000],Line1[1000],Line2[1000];
int init()
{
SetIndexBuffer(0,Buf_0);
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
return;
}
extern double PeriodPower=13;
extern double MA_Period=5;
int start()
{
int i=Bars-IndicatorCounted()-1;
while(i>=0)
{
Bulls_array[i]=iBullsPower(NULL,0,PeriodPower,PRICE_CLOSE,i);
Bears_array[i]=iBearsPower(NULL,0,PeriodPower,PRICE_CLOSE,i);
ArraySetAsSeries(Bears_array,true); // Applied for synchronization of indexing in the iMAOnArray function
ArraySetAsSeries(Bulls_array,true);
Line1[i]=iMAOnArray(Bears_array,0,MA_Period,0,MODE_SMMA,i);
Line2[i]=iMAOnArray(Bulls_array,0,MA_Period,0,MODE_SMMA,i);
Buf_0[i]=(Line2[i]+Line1[i])/Point/10;
i--;
}
return;
}
It can be screwed around but it can be done in a normal way.
The indicator may contain up to 8 buffers. Some of them may be used for intermediate calculations.
However, if performance is not critical, then yes, you can do it that way.
You can play around or you can do it normally.
The indicator can contain up to 8 buffers. Some of them can be used for intermediate calculations.
Although, if it is not critical for yourself and the performance, then yes, you can do it that way.
The notion of normal is relative. So is the notion of right. This is more of a philosophical question. I tried to implement the algorithm in an OPTIMAL way. In order to build an indicator in ONE cycle. In my opinion it is the least loading of hardware, while you can get the same result.
>> And, as for the fact that there are 8 buffers, and in wartime their number can reach 54 and a half, any sapper knows it. :-)
Normal is relative. So is the concept of right. This is more of a philosophical question. I tried to implement the algorithm in an OPTIMAL way. So that the indicator is built in ONE cycle. In my opinion, it loads the hardware the least when the result is still correct.
About 8 buffers, and their number in wartime can reach up to 54 and a half, every engineer knows it. :-)
It's possible to do everything in one loop, and to use minimum buffers, but that's another story.
Any operation with an array (not a buffer) takes considerable time. Therefore, it was easier and faster to make several loops than to cram everything into one.
Faster in the sense of operation of the indicator.
It is possible to do everything in one cycle, and to use a minimum number of buffers, but that's a whole other conversation.
Any operation with an array (not a buffer) takes a long time. Therefore, it was easier and faster to make several loops than to cram everything into one.
Faster in the sense of the indicator's performance.
Tell me, Vinin, did you try to take a look at your idea and see what it draws?
It is possible to do everything in one cycle, and to use a minimum number of buffers, but that's a whole other conversation.
Any operation with an array (not a buffer) takes a long time. Therefore, it was easier and faster to make several loops than to cram everything into one.
Faster in the sense of the indicator's performance.
Dear Vinin, did you try to take a look at your idea and figure it out?
int start()
{
int i, limit=Bars-IndicatorCounted()-1;
for (i=limit;i>=0;i--){
Bears_array[i]=iBearsPower(NULL,0,PeriodPower,PRICE_CLOSE,i);
Bulls_array[i]=iBullsPower(NULL,0,PeriodPower,PRICE_CLOSE,i);
}
for (i=limit;i>=0;i--){
MA_Bears[i]=iMAOnArray(Bears_array,0,MA_Period,0,MODE_EMA,i);
MA_Bulls[i]=iMAOnArray(Bulls_array,100,MA_Period,0,MODE_SMA,i);
}
return;
}
I understand that in the first loop you form an array of bulls and bears. In the second cycle these two arrays are smoothed. If you like it so much, just look at the result and you will understand everything.
Take a close look at the AGRAPHIC GRAPHIC
I was talking about this kind of indicator code in general.
I agree. It outputs fine and everything is correct. I just needed to display the following output
Buf_0[i]=(Line2[i]+Line1[i])/Point/10;
It should be done in a separate loop. I prefer your version because I prefer the FOR loop. Thank you for your help and attention.