Page 39 of 180
Re: Coding Help
Posted: Thu Jun 08, 2017 10:58 pm
by mladen
shaileshm wrote: Thu Jun 08, 2017 10:54 pm
thats same as uptick. What I would need is if ticks are in same direction then it gets added and if its in different direction then it is subtracted.
Sorry
My typo. The code should be
difftick = iClose(ForSymbol,0,i)-iOpen(ForSymbol,0,i)
Re: Coding Help
Posted: Thu Jun 08, 2017 11:41 pm
by shaileshm
mladen wrote: Thu Jun 08, 2017 10:58 pm
Sorry
My typo. The code should be
difftick = iClose(ForSymbol,0,i)-iOpen(ForSymbol,0,i)
that gives same a total volume (up + down). I am looking for something which can give me (up-down)
Re: Coding Help
Posted: Fri Jun 09, 2017 12:34 am
by mladen
shaileshm wrote: Thu Jun 08, 2017 11:41 pm
that gives same a total volume (up + down). I am looking for something which can give me (up-down)
shaileshm
Unless there is some source for tick data for desired period, there is no way to get that
Re: Coding Help
Posted: Sun Jun 11, 2017 10:26 pm
by Newton51
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
Posted: Sun Jun 11, 2017 11:07 pm
by GERVASE
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
Posted: Mon Jun 12, 2017 1:03 am
by mladen
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
Posted: Mon Jun 12, 2017 1:44 am
by GERVASE
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
Posted: Mon Jun 12, 2017 1:57 am
by mladen
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
Re: Coding Help
Posted: Mon Jun 12, 2017 2:08 am
by GERVASE
mladen wrote: Mon Jun 12, 2017 1:57 am
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
Hi, mladen
Thanks for great help!
Have a nice day!
Re: Coding Help
Posted: Mon Jun 12, 2017 10:29 pm
by uncle wong
Mladen,
Is it possible to code this Market Watch tick chart?I am not asking you to code it,just I want to know if it is possible.