Coding help - page 63

 

In that way you check only the oriders withthe specified magic number (and symbol)

dasio:
In this way i check the order that are not opened with specified magicnumber right? I need to check the order with specific symbol and magic number. I don't know if it is important but i found the error in strategy tester
 
drofwarc:
Hi all,

I know that it's possible to make an EA pause between trades, either by using Sleep() or by recording a timestamp and waiting for n seconds after the timestamp before permitting another signal.

But is it possible to do the same for an indicator.

For example, I would like to be able to cause an indicator that plots arrows at the cross of two moving averages to skip n bars after a cross before plotting another arrow. In other words, if another cross occurred before n bars had gone by, the indicator would ignore the cross and not plot an arrow.

I've searched extensively to find an indicator that does this but have not had any luck.

Could someone either post an indicator that has this feature already so that I can study the code? Or perhaps provide me an example of code that works for this propose so that I can try to implement it.

Many thanks,

drofwarc

BUMP!

Hi mladen, I know you're busy with so many requests throughout the forum. But I would greatly appreciate if you would at least steer me in the direction of a coding solution for this.

Many thanks in advance.

drofwarc

 

drofwarc

Sleep() function does not work in indicators so you can forget about the timer from the indicators (if you depend on ticks you can not get an exact time). As of counting : it is no problem coding wise. If you provide some example that you have worked on than it could be shown how to count in cases like that

drofwarc:
BUMP!

Hi mladen, I know you're busy with so many requests throughout the forum. But I would greatly appreciate if you would at least steer me in the direction of a coding solution for this.

Many thanks in advance.

drofwarc
 
mladen:
drofwarc Sleep() function does not work in indicators so you can forget about the timer from the indicators (if you depend on ticks you can not get an exact time). As of counting : it is no problem coding wise. If you provide some example that you have worked on than it could be shown how to count in cases like that

Hi mladen,

Thank you for responding. Below is the code for a simple indicator that plots an arrow each time price reverses. What I want to be able to do is this: after the indicator has found a valid setup, it should look back n bars (with n being ajustable in the settings) to determine whether or not a valid signal was present.

If a valid signal is present within the lookback period, it will not plot a new arrow based on the current valid setup.

If a valid signal is not present within the lookback period, it willplot a new arrow based on the current valid setup.

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Red

#property indicator_color2 DodgerBlue

double UpArrowBuffer[];

double DownArrowBuffer[];

///////////Arrows

extern int ArrowSize = 1;

extern int Offset = 100;

extern color UpColor = White;

extern color DnColor = White;

extern color NoSignalColor = DarkGray;

extern int myWingDing1 = 233 ;

extern int myWingDing2 = 234 ;

double Poin;

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

//| Custom indicator initialization function |

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

int init() {

//---- indicator buffers mapping

SetIndexBuffer(0,UpArrowBuffer);

SetIndexBuffer(1,DownArrowBuffer);

//---- drawing settings

SetIndexStyle(0,DRAW_ARROW,0,ArrowSize, UpColor);

SetIndexArrow(0,myWingDing1);

SetIndexStyle(1,DRAW_ARROW,0,ArrowSize, DnColor);

SetIndexArrow(1,myWingDing2);

Poin = Point;

if ((Point == 0.00001) || (Point == 0.001)) Poin *= 10;

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit() {

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start() {

int limit;

int counted_bars=IndicatorCounted();

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

for(int i=limit; i>=0; i--)

{

if (Close Open)

{

UpArrowBuffer = Low - Offset*Point;

}

if (Close > Open && Close < Open)

{

DownArrowBuffer = High + Offset*Point;

}

}

return(0);

}

//+------------------------------------------------------------------+*/

I hope this is clear .

Kind regards,

drofwarc

 

help

can anyone help me with this?

i want to use two "VoltyChannel_Stop_v2.1_TRO_MODIFIED_VERSION+.mq4" in one chart with different setting but

when i place two, only one price box shows. is there a way to be able to show both price boxes?

 

drofwarc

Attached is a modified indicator that can count bars from the last signal of same kind before allowing a new signal to show. Here is an example with 15 bars distance set :

drofwarc:
Hi mladen,

Thank you for responding. Below is the code for a simple indicator that plots an arrow each time price reverses. What I want to be able to do is this: after the indicator has found a valid setup, it should look back n bars (with n being ajustable in the settings) to determine whether or not a valid signal was present.

If a valid signal is present within the lookback period, it will not plot a new arrow based on the current valid setup.

If a valid signal is not present within the lookback period, it willplot a new arrow based on the current valid setup.

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Red

#property indicator_color2 DodgerBlue

double UpArrowBuffer[];

double DownArrowBuffer[];

///////////Arrows

extern int ArrowSize = 1;

extern int Offset = 100;

extern color UpColor = White;

extern color DnColor = White;

extern color NoSignalColor = DarkGray;

extern int myWingDing1 = 233 ;

extern int myWingDing2 = 234 ;

double Poin;

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

//| Custom indicator initialization function |

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

int init() {

//---- indicator buffers mapping

SetIndexBuffer(0,UpArrowBuffer);

SetIndexBuffer(1,DownArrowBuffer);

//---- drawing settings

SetIndexStyle(0,DRAW_ARROW,0,ArrowSize, UpColor);

SetIndexArrow(0,myWingDing1);

SetIndexStyle(1,DRAW_ARROW,0,ArrowSize, DnColor);

SetIndexArrow(1,myWingDing2);

Poin = Point;

if ((Point == 0.00001) || (Point == 0.001)) Poin *= 10;

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit() {

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start() {

int limit;

int counted_bars=IndicatorCounted();

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

for(int i=limit; i>=0; i--)

{

if (Close Open)

{

UpArrowBuffer = Low - Offset*Point;

}

if (Close > Open && Close < Open)

{

DownArrowBuffer = High + Offset*Point;

}

}

return(0);

}

//+------------------------------------------------------------------+*/

I hope this is clear .

Kind regards,

drofwarc
Files:
test.gif  41 kb
_test.mq4  3 kb
 
ZANKY:
can anyone help me with this?

i want to use two "VoltyChannel_Stop_v2.1_TRO_MODIFIED_VERSION+.mq4" in one chart with different setting but

when i place two, only one price box shows. is there a way to be able to show both price boxes?

Just change line 85 with this and compile it, it should work as a type of magic number so as long as any of the inputs are changed the second price box will also load.

ftShortName = "tbb"+ symbol + tChartPeriod +MA_Length + ATR_Length + Kv + MA_Mode +MoneyRisk + MA_Price;

 

Thank you!

cja

Thank you very much! It works perfect.

 

Hello Mladen. I do not know much English, Sorry.

Please help me to make these indicators when the line goes up or down in a different color. Thank you!

Files:
1234.gif  23 kb
rmi.mq4  5 kb
 
mladen:
drofwarc

Attached is a modified indicator that can count bars from the last signal of same kind before allowing a new signal to show. Here is an example with 15 bars distance set :

Hello mladen,

Thank you! It's exactly what I was looking for.

The best of the Holiday Season to you!

drofwarc

Reason: