Coding help - page 201

 
Slow Moe:
Hi, i want to ask, if it is possible to rewrite this Indicator, so that it only shows the arrows, and they should show up at the candlesticks ? Could somebody help me with this, or maby code it for me please ?

regards

Slow

fxmtn-test.mq4

Slow

Try it like this

Files:
 

Thanks a lot mladen working beautyfull !!

I'm trying to get "extern int arrowDistance = XXX;" somehow activated too.

It shows up in the select menu now, but has not changing Distance. Where to put the *arrowDistance ?

Or am i totally wrong ?

I did put it into several places, but it only gave me more dots, not more distance....

Noob trying to understand the code, and hoping for some light

 

Did it now like this :

if (AboveBuff > 24.0) ShortBuff = High+ (Point*arrowDistance /2);

if (BelowBuff < -24.0) LongBuffe = Low- (Point*arrowDistance /2);

Is this a right way ?? Just because it works, it can be wrong

 
Slow Moe:
Did it now like this :

if (AboveBuff > 24.0) ShortBuff = High+ (Point*arrowDistance /2);

if (BelowBuff < -24.0) LongBuffe = Low- (Point*arrowDistance /2);

Is this a right way ?? Just because it works, it can be wrong

That should work, there is another way can do it like this

LongBuffe = Low-arrowDistance*iATR(NULL,0,20,i) and ShortBuff = High+arrowDistance**iATR(NULL,0,20,i)

 

Slow,

Better to use the iATR() mode. Change time frames and you will see what I mean. Visually you will have a problem on higher time frames when the distance of an arrow from high or low is fixed (they will look messy on some time frame). Using iATR() instead of using fixed distance solves that problem

 

Thanks mrtools,mladen working really way better.

One last indicator i can't controll ....

Trying to change it here : SignalGap = MathCeil(iATR(NULL,0,50,0)/Point);

Thought this was the right spot, since changing the 50 changes the distance. But nothing i tested did work with arrowDistance.

 
Slow Moe:
Thanks mrtools,mladen working really way better.

One last indicator i can't controll ....

Trying to change it here : SignalGap = MathCeil(iATR(NULL,0,50,0)/Point);

Thought this was the right spot, since changing the 50 changes the distance. But nothing i tested did work with arrowDistance.

Slow

When you are suing atr for arrows distance probably the best way to modify that distance is a kind of multiplier. For example :

arrowPrice = High+iATR(NULL,0,50,0)*arrowDistance;

Where arrowDistance is defined as double and can be fractional (so you could use values like 0.5 as well as values like 10.5 as well). Changing atr period will not change the distance significantly (it will just take a longer average of ranges into account)

 

try to get the value from another indicator

hello com,

i am trying to write my first own indicator and i want to use also a value from an existing indicator which i got from this site. i just copied the code from the indi here.

what do i have to code in my new indicator to know if the bar is blue/red or 1/0 i dont mind but i tried already alot and all the time just get zero

i even tried to get the whole code in my indicator which did not work.

any help would be appreciated

thx bob

#property copyright "fxfariz"

#property link "fxfariz@gmail.com"

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Blue //Red //Aqua

#property indicator_color2 Red

extern int SSP=7;

extern double Kmax=50.6; //24 21.6 21.6

extern int CountBars=300;

extern int myPeriod = 0 ;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

double ExtHBuffer1[];

double ExtHBuffer2[];

int xPeriod ;

//+------------------------------------------------------------------+

string TimeFrameToString(int tf)

{

string tfs;

switch(tf) {

case PERIOD_M1: tfs="M1" ; break;

case PERIOD_M5: tfs="M5" ; break;

case PERIOD_M15: tfs="M15" ; break;

case PERIOD_M30: tfs="M30" ; break;

case PERIOD_H1: tfs="H1" ; break;

case PERIOD_H4: tfs="H4" ; break;

case PERIOD_D1: tfs="D1" ; break;

case PERIOD_W1: tfs="W1" ; break;

case PERIOD_MN1: tfs="MN1";

}

return(tfs);

}

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

IndicatorBuffers(4);

SetIndexStyle(0,DRAW_HISTOGRAM,0,4); //Red

SetIndexBuffer(0,ExtHBuffer1);

SetIndexStyle(1,DRAW_HISTOGRAM,0,4); //Lime

SetIndexBuffer(1,ExtHBuffer2);

SetIndexBuffer(2,ExtMapBuffer1);

SetIndexBuffer(3,ExtMapBuffer2);

if(myPeriod==0){xPeriod=Period();} {xPeriod=myPeriod;}

string tPeriod = TimeFrameToString(xPeriod) ;

IndicatorShortName(tPeriod + " Trade What You see ("+SSP+")");

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custor indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

if (CountBars>=Bars) CountBars=Bars;

SetIndexDrawBegin(0,Bars-CountBars+SSP);

SetIndexDrawBegin(1,Bars-CountBars+SSP);

int i, counted_bars=IndicatorCounted();

double SsMax, SsMin, smin, smax;

if(Bars<=SSP+1) return(0);

if(counted_bars<SSP+1)

{

for(i=1;i<=SSP;i++) ExtMapBuffer1[CountBars-i]=0.0;

for(i=1;i<=SSP;i++) ExtMapBuffer2[CountBars-i]=0.0;

}

for(i=CountBars-SSP;i>=0;i--) {

SsMax = High;

SsMin = Low[Lowest(NULL,xPeriod,MODE_LOW,SSP,i-SSP+1)];

smax = SsMax-(SsMax-SsMin)*Kmax/100;

ExtMapBuffer1=smax;

ExtMapBuffer2=smax;

}

for(int b=CountBars-SSP;b>=0;b--)

{

if(ExtMapBuffer1>ExtMapBuffer2)

{

ExtHBuffer1=1;

ExtHBuffer2=0;

}

else

{

ExtHBuffer1=0;

ExtHBuffer2=1;

}

}

return(0);

}
 
BobMorane1000:
hello com,

i am trying to write my first own indicator and i want to use also a value from an existing indicator which i got from this site. i just copied the code from the indi here.

what do i have to code in my new indicator to know if the bar is blue/red or 1/0 i dont mind but i tried already alot and all the time just get zero

i even tried to get the whole code in my indicator which did not work.

any help would be appreciated

thx bob

#property copyright "fxfariz"

#property link "fxfariz@gmail.com"

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Blue //Red //Aqua

#property indicator_color2 Red

extern int SSP=7;

extern double Kmax=50.6; //24 21.6 21.6

extern int CountBars=300;

extern int myPeriod = 0 ;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

double ExtHBuffer1[];

double ExtHBuffer2[];

int xPeriod ;

//+------------------------------------------------------------------+

string TimeFrameToString(int tf)

{

string tfs;

switch(tf) {

case PERIOD_M1: tfs="M1" ; break;

case PERIOD_M5: tfs="M5" ; break;

case PERIOD_M15: tfs="M15" ; break;

case PERIOD_M30: tfs="M30" ; break;

case PERIOD_H1: tfs="H1" ; break;

case PERIOD_H4: tfs="H4" ; break;

case PERIOD_D1: tfs="D1" ; break;

case PERIOD_W1: tfs="W1" ; break;

case PERIOD_MN1: tfs="MN1";

}

return(tfs);

}

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

IndicatorBuffers(4);

SetIndexStyle(0,DRAW_HISTOGRAM,0,4); //Red

SetIndexBuffer(0,ExtHBuffer1);

SetIndexStyle(1,DRAW_HISTOGRAM,0,4); //Lime

SetIndexBuffer(1,ExtHBuffer2);

SetIndexBuffer(2,ExtMapBuffer1);

SetIndexBuffer(3,ExtMapBuffer2);

if(myPeriod==0){xPeriod=Period();} {xPeriod=myPeriod;}

string tPeriod = TimeFrameToString(xPeriod) ;

IndicatorShortName(tPeriod + " Trade What You see ("+SSP+")");

//----

return(0);

}

//+------------------------------------------------------------------+

//| Custor indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

if (CountBars>=Bars) CountBars=Bars;

SetIndexDrawBegin(0,Bars-CountBars+SSP);

SetIndexDrawBegin(1,Bars-CountBars+SSP);

int i, counted_bars=IndicatorCounted();

double SsMax, SsMin, smin, smax;

if(Bars<=SSP+1) return(0);

if(counted_bars<SSP+1)

{

for(i=1;i<=SSP;i++) ExtMapBuffer1[CountBars-i]=0.0;

for(i=1;i<=SSP;i++) ExtMapBuffer2[CountBars-i]=0.0;

}

for(i=CountBars-SSP;i>=0;i--) {

SsMax = High;

SsMin = Low[Lowest(NULL,xPeriod,MODE_LOW,SSP,i-SSP+1)];

smax = SsMax-(SsMax-SsMin)*Kmax/100;

ExtMapBuffer1=smax;

ExtMapBuffer2=smax;

}

for(int b=CountBars-SSP;b>=0;b--)

{

if(ExtMapBuffer1>ExtMapBuffer2)

{

ExtHBuffer1=1;

ExtHBuffer2=0;

}

else

{

ExtHBuffer1=0;

ExtHBuffer2=1;

}

}

return(0);

}

BobMorane1000

You could do something like this :

bool blueValue = (iCustom(NULL,0,"indicatorNameHere",SSP,Kmax,0,0)!=0);

bool redValue = (iCustom(NULL,0,"indicatorNameHere",SSP,Kmax,1,0)!=0);

But be careful. That indicator is a variation of super signal indicator, and super signal indicator recalculates (repaints)

 

thank you very much and for your warning^^, i will try it now ...

Reason: