Re: Coding Help

384
mladen wrote: Mon May 01, 2017 6:47 pm I stand corrected
You can do that - see the following code - and it works in run-time too

Code: Select all

   Comment("Current fixed minimum : "+(string)WindowPriceMin(WindowFind(shortName))+"\n"+
           "Current fixed maximum : "+(string)WindowPriceMax(WindowFind(shortName)));
mladen I really appreciate you helping me with this problem. I got curious this evening and thought "I wonder if...".

I had already created a boolean switch to show Comments (or not) and I changed "Comment" to a string "StrComment". It didn't work until I manually declared the window number ("SubWinRef", (1)) and then it works a treat, just as I had hoped. I thought it appropriate to feed this back to you to add to our knowledge base.

if(ShowScaleMax){
ScrComment=DoubleToStr((string)WindowPriceMax(WindowFind(SubWinRef)),2);
}
Thank you again. I could not have done this without your help and I have learned a new thing.

Re: Coding Help

385
Dear code experts:
I saw the StepMA_v1.mq4 code, but i have concern about the the variable smin0,smax0,smin1,smax1, so the smax1 & smin1 are the previous bar value of smax0&smin0? and this code work? for my understanding, should write the code like: smin[shift], smin[shift+1].
Thanks!

int start()
{
int shift,trend;
double smin0,smax0,smin1,smax1;


for(shift=Bars-1;shift>=0;shift--)
{
if (HighLow>0)
{
smax0=Low[shift]+2*StepSize*Point;
smin0=High[shift]-2*StepSize*Point;

if(Close[shift]>smax1) trend=1;
if(Close[shift]<smin1) trend=-1;
}

if (HighLow == 0)
{
smax0=Close[shift]+2*StepSize*Point;
smin0=Close[shift]-2*StepSize*Point;

if (Close[shift]>smax1) trend=1;
if (Close[shift]<smin1) trend=-1;
}

if(trend>0 && smin0<smin1) smin0=smin1;
if(trend<0 && smax0>smax1) smax0=smax1;

if (trend>0) LineBuffer[shift]=smin0+StepSize*Point;
if (trend<0) LineBuffer[shift]=smax0-StepSize*Point;

smin1=smin0;
smax1=smax0;


Re: Coding Help

386
GERVASE wrote: Sun Jun 11, 2017 11:07 pm Dear code experts:
I saw the StepMA_v1.mq4 code, but i have concern about the the variable smin0,smax0,smin1,smax1, so the smax1 & smin1 are the previous bar value of smax0&smin0? and this code work? for my understanding, should write the code like: smin[shift], smin[shift+1].
Thanks!

int start()
{
int shift,trend;
double smin0,smax0,smin1,smax1;


for(shift=Bars-1;shift>=0;shift--)
{
if (HighLow>0)
{
smax0=Low[shift]+2*StepSize*Point;
smin0=High[shift]-2*StepSize*Point;

if(Close[shift]>smax1) trend=1;
if(Close[shift]<smin1) trend=-1;
}

if (HighLow == 0)
{
smax0=Close[shift]+2*StepSize*Point;
smin0=Close[shift]-2*StepSize*Point;

if (Close[shift]>smax1) trend=1;
if (Close[shift]<smin1) trend=-1;
}

if(trend>0 && smin0<smin1) smin0=smin1;
if(trend<0 && smax0>smax1) smax0=smax1;

if (trend>0) LineBuffer[shift]=smin0+StepSize*Point;
if (trend<0) LineBuffer[shift]=smax0-StepSize*Point;

smin1=smin0;
smax1=smax0;

GERVASE

Use some of the new stepMA indicators - for multiple reasons, one being that the new versions (of all step things) are not repainting

Re: Coding Help

387
mladen wrote: Mon Jun 12, 2017 1:03 am
GERVASE

Use some of the new stepMA indicators - for multiple reasons, one being that the new versions (of all step things) are not repainting
Hi, mladen.
Thanks a lot! I will check the new stepMA, there are so many versions.
Which I confuse for the above code is that the smax1 & smin1 value, where they are from?
Thanks!

Re: Coding Help

388
GERVASE wrote: Mon Jun 12, 2017 1:44 am Hi, mladen.
Thanks a lot! I will check the new stepMA, there are so many versions.
Which I confuse for the above code is that the smax1 & smin1 value, where they are from?
Thanks!
That is one of the very old versions that had that issue
After that we started to realize how non repainting code should be done


Who is online

Users browsing this forum: No registered users and 6 guests