I am studying mql4 programming. Now I want to plot sin wave in separate window.
My code as below,It does not work,it shows nothing.
Anyone help to revise ? Thanks a lot.
Dear sergery,
void MyCalc(int Shift,int Yhigh) { int i; for(i=Shift;i<=0;i--) <-- should be i>=0 not i<=0 ************ { Dgr[i]=i*2.5; Dgr[i]=MathSin(3.14159*Dgr[i]/180)+Yhigh; } }
Hi , I was wondering if someone could show some added code that would allow the sin wave to continue to the right of the zero candle with a shift right input.
Thanks.
Dgr[i]=MathSin(3.14159*Dgr[i]/180)+Yhigh;
- Set the buffer shift.
- Fill the array.
double val=i*2.5; Dgr[i]=MathSin(3.14159*val/180)+Yhigh;
Hi, William Roeder.
Perhaps I should have mentioned that I am not a coder. I have tried my best to implement the above code you provided, but to no avail. Looks like I need to define a second Buffer[] and set it with SetIndexShift(); . and then add the code
double val=i*2.5; Dgr[i]=MathSin(3.14159*val/180)+Yhigh;
Sorry I am totally lost. If I am asking to much please say so. If it could be explained a little more in debth I would be greatly appreciated. Thanks.
Like I said, I am not a programmer. I have read as much documentation regarding this need for help as I could , it is like me trying to understanding Greek. I think the program is a good indicator and perhaps could be an indicator that could help predict entries and exits to trades... I am sorry that I am not a computer language coder. All I was trying to do was ask for a little help. Perhaps someone else could try and give a little help with the above request. Thanks
I doubt that. I gave you the link to SetIndexShift(). All you had to do was look at the example and compare it to your init and add one line of code.
Instead, you babel something about a second buffer and when pointed in the right direction, you do nothing.
I doubt that. I gave you the link to SetIndexShift(). All you had to do was look at the example and compare it to your init and add one line of code.
Instead, you babel something about a second buffer and when pointed in the right direction, you do nothing.
Why do you ALWAYS insult people who ask for help on this site. I have read many post in a lot of different categories on this site and You almost always insult the people who struggle with mql4 and mql5 code questions... I do not know if you own this site but you are Not a person with compassion and a desire to help people. I did solve the above problem and it was NOT because of your help PERIOD.
I always try to help people. But there are no slaves here. When they want it done for them, they are lazy, they put in no effort to learn. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
All you have done is whine about not being a programmer, not a coder. You have wasted hundreds of people's time with this repeated "help me." You don't want help, you want it done for you.
Don't do that. Someone searching might find this thread and still be clueless. What was the problem? What solved what?
How To Ask Questions The Smart Way. (2004)
When You Ask.
Follow up with a brief note on the solution.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am studying mql4 programming. Now I want to plot sin wave in separate window.
My code as below,It does not work,it shows nothing.
Anyone help to revise ? Thanks a lot.
//+------------------------------------------------------------------+
//| Accelerator.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 1 //
#property indicator_color1 Red //
//---- indicator buffers
double ExtBuffer1[];
double Dgr[];
extern datetime StartTime=D'1999.11.10 00:00';
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(1);
SetIndexStyle(0,DRAW_LINE);
SetLevelValue(0,0); //
//----indicator buffers mapping //
SetIndexBuffer(0,ExtBuffer1);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Accelerator/Decelerator Oscillator |
//+------------------------------------------------------------------+
int start()
{
int Shift;
int i;
Shift=iBarShift(Symbol(),PERIOD_D1,StartTime); // Only run on PERIOD_D1
ArrayResize(Dgr,Shift+1);
MyCalc(Shift,1);
for(i=Shift; i>=0; i--)
ExtBuffer1[i]=Dgr[i];
return(0);
}
//+------------------------------------------------------------------+
void MyCalc(int Shift,int Yhigh)
{
int i;
for(i=Shift;i<=0;i--)
{
Dgr[i]=i*2.5;
Dgr[i]=MathSin(3.14159*Dgr[i]/180)+Yhigh;
}
}