Coding help - page 227

 
Air92:
Hello Mladen.You made the version this indicator. I want to ask to make here separately moving average, as on the example of other indicator if it is possible. Thank you.

Air92

It can not be done (already 8 drawing buffers used - metatrader 4 does not allow more than 8 drawing buffers)

 
mladen:
Air92 It can not be done (already 8 drawing buffers used - metatrader 4 does not allow more than 8 drawing buffers)

Ok,Mladen.I understood.Thank you

 

Hi Mladen,

Could you please convert this MACD MTF indi to an EA, buy when macd is green on any 3 tf, sell when any three red. close trade and open new on reverse trend.

settings needed: trail, breakeven, sloss, entry on open or closed bar, Magic number and lot size . On lower tf it works well ! Will appreciate. Thanks

Files:
 

Hi, I found something interesting for all of us in the forum.there is this software that can help to predict the direction of the next candle.I have been working on this mt4 script to add volatility to it but could not.I want also make the alert to come at the close of the current candle and tell us the direction of the next about-to-form candle.the volatility will us tell us the size or how far the price will stretch.the principle was not mine.i copy it from somewhere.the script is really working.i want a programmer like Codergurus and Mladin to please look into this script.It is not really working well now.as the alert keep on reaping and repainting.

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Lime

#property indicator_color2 Red

#property indicator_width1 4

#property indicator_width2 4

extern bool Alerts = TRUE;

double CrossUp[];

double CrossDown[];

bool CrossedUp = false;

bool CrossedDown = false;

int SignalLabeled = 0; // 0: initial state; 1: up; 2: down.

int upalert=false,downalert=false;

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_ARROW, EMPTY);

SetIndexArrow(0,233);

SetIndexBuffer(0,CrossUp);

SetIndexStyle(1,DRAW_ARROW, EMPTY);

SetIndexArrow(1,234);

SetIndexBuffer(1,CrossDown);

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start(){

int limit,i,counter;

double pnow;

double p1,p2,p3,p4,p5,p6,p7,p8,p9,p10;

double SOT,SOT1,SOT2,SOT3,SOT4,SOT5,SOT6,SOT7,SOT8,SOT9,SOT10;

double SOTAV10;

double SOTAV2;

double Range, AvgRange;

int counted_bars=IndicatorCounted();

//---- check for possible errors

if(counted_bars<0) return(-1);

//---- last counted bar will be recounted

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

for(i = 0; i <= limit; i++) {

counter=i;

Range=0;

AvgRange=0;

for (counter=i;counter<=i+12;counter++)

{

AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);

}

Range=AvgRange/10;

// current price Close and Open

double OpenPricenow = Open ;

double ClosePricenow = Close ;

double Volumenow = Volume ;

// candle 1

double OpenPrice1 = Open ;

double ClosePrice1 = Close ;

double Volume1 = Volume ;

// candle 2

double OpenPrice2 = Open ;

double ClosePrice2 = Close ;

double Volume2 = Volume ;

// candle 3

double OpenPrice3 = Open ;

double ClosePrice3 = Close ;

double Volume3 = Volume ;

// candle 4

double OpenPrice4 = Open ;

double ClosePrice4 = Close ;

double Volume4 = Volume ;

// candle 5

double OpenPrice5 = Open ;

double ClosePrice5 = Close ;

double Volume5 = Volume ;

// candle 6

double OpenPrice6 = Open ;

double ClosePrice6 = Close ;

double Volume6=Volume ;

// candle 7

double OpenPrice7 = Open ;

double ClosePrice7 = Close ;

double Volume7 = Volume ;

// candle 8

double OpenPrice8 =Open ;

double ClosePrice8 =Close ;

double Volume8 =Volume;

// candle 9

double OpenPrice9 = Open ;

double ClosePrice9 = Close ;

double Volume9 = Volume ;

// candle 10

double OpenPrice10 =Open;

double ClosePrice10=Close;

double Volume10=Volume;

pnow =(ClosePricenow - OpenPricenow);

SOT = (pnow / Volumenow)*10000;

p1 = (ClosePrice1 - OpenPrice1);

SOT1= (p1 / Volume1) *10000;

p2 = (ClosePrice2 - OpenPrice2);

SOT2 =(p2/ Volume2) *10000;

p3 =(ClosePrice3 - OpenPrice3);

SOT3 =(p3/Volume3)*10000;

p4=(ClosePrice4 - OpenPrice4);

SOT4=(p4/Volume4)*10000;

p5=(ClosePrice5 - OpenPrice5);

SOT5 =(p5/Volume5)*10000;

p6=(ClosePrice6 - OpenPrice6);

SOT6 =(p6/Volume6)*10000;

p7=(ClosePrice7 - OpenPrice7);

SOT7 =(p7 / Volume7)*10000;

p8 =(ClosePrice8 - OpenPrice8);

SOT8=(p8/Volume8)*10000;

p9 =(ClosePrice9-OpenPrice9);

SOT9 =(p9/Volume9)*10000;

p10 =(ClosePrice10 -OpenPrice10);

SOT10 = (p10/Volume10)*10000;

SOTAV10=(SOT1+SOT2+SOT3+SOT4+SOT5+SOT6+SOT7+SOT8+SOT9+SOT10/100*10);

SOTAV2 = (SOTAV10*2);

if ((SOT>SOTAV2)&&(ClosePrice1<OpenPrice1)&&(ClosePricenow<OpenPrice1)){

CrossedUp = true;

CrossedDown= false;

}

else

if((SOT>SOTAV2)&&(ClosePrice1>OpenPrice1)&&(ClosePricenow>OpenPricenow)){

CrossedUp = false;

CrossedDown = true;

}

if((CrossedUp==true)&&(SignalLabeled!=1)){

CrossUp=Low-Range*1.3;

if(i<=2 && Alerts && !upalert)

{

Alert (Symbol()," ",Period()," M Price UP ");

//SendMail("Buy "+Symbol(),"");

upalert=true;

downalert=false;

}

SignalLabeled = 1;

}

if ((CrossedDown == true) && (SignalLabeled != 2)) {

CrossDown = High + Range*1.3;

if(i<=2 && Alerts && !downalert)

{

Alert (Symbol()," ",Period(),"M Price DOWN ");

//SendMail("Sell "+Symbol(),"");

downalert=true;

upalert=false;

}

SignalLabeled = 2;

}

}

return(0);

}

This is the principle that guild this software:

Speed of trade = (Price Change / Volume) per unit time. = (Open-Close)/tick volume in the default period.

If SoT of current candle is greater than twice the average SoT of the selected period, next candle will be in the same direction of the current candle. (Our signals can be given at the close of the current candle).

Caution: If current candle is followed by same color 2-3 candles, no signal is to be given. As an example: Date E/J(Open) E/J(High) E/J(Low) E/J(Close) Volume(E/J) Direction Price change Speed 11/06/2012 03:56:00 102.456 102.456 102.429 102.429 96 DOWN -0.027 2.81 11/06/2012 03:57:00 102.429 102.429 102.398 102.413 158 DOWN -0.016 1.01 as speed is greater than 1.70 (average of 14 candles), it predicts that next candle will be down. This indicator can be made to look like a speedometer or just the number can appear with the signal on the candle. I think this will help a great deal in making right decisions. The theory behind this is that every rise or fall needs a force or inertia greater than the existing force, so as soon we see or capture such extra force, we can determine the next candle direction and values also.

......................................................................................................................

 
Mastercash:
Hi, I found something interesting for all of us in the forum.there is this software that can help to predict the direction of the next candle.I have been working on this mt4 script to add volatility to it but could not.I want also make the alert to come at the close of the current candle and tell us the direction of the next about-to-form candle.the volatility will us tell us the size or how far the price will stretch.the principle was not mine.i copy it from somewhere.the script is really working.i want a programmer like Codergurus and Mladin to please look into this script.It is not really working well now.as the alert keep on reaping and repainting.

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Lime

#property indicator_color2 Red

#property indicator_width1 4

#property indicator_width2 4

extern bool Alerts = TRUE;

double CrossUp[];

double CrossDown[];

bool CrossedUp = false;

bool CrossedDown = false;

int SignalLabeled = 0; // 0: initial state; 1: up; 2: down.

int upalert=false,downalert=false;

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_ARROW, EMPTY);

SetIndexArrow(0,233);

SetIndexBuffer(0,CrossUp);

SetIndexStyle(1,DRAW_ARROW, EMPTY);

SetIndexArrow(1,234);

SetIndexBuffer(1,CrossDown);

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start(){

int limit,i,counter;

double pnow;

double p1,p2,p3,p4,p5,p6,p7,p8,p9,p10;

double SOT,SOT1,SOT2,SOT3,SOT4,SOT5,SOT6,SOT7,SOT8,SOT9,SOT10;

double SOTAV10;

double SOTAV2;

double Range, AvgRange;

int counted_bars=IndicatorCounted();

//---- check for possible errors

if(counted_bars<0) return(-1);

//---- last counted bar will be recounted

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

for(i = 0; i <= limit; i++) {

counter=i;

Range=0;

AvgRange=0;

for (counter=i;counter<=i+12;counter++)

{

AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);

}

Range=AvgRange/10;

// current price Close and Open

double OpenPricenow = Open ;

double ClosePricenow = Close ;

double Volumenow = Volume ;

// candle 1

double OpenPrice1 = Open ;

double ClosePrice1 = Close ;

double Volume1 = Volume ;

// candle 2

double OpenPrice2 = Open ;

double ClosePrice2 = Close ;

double Volume2 = Volume ;

// candle 3

double OpenPrice3 = Open ;

double ClosePrice3 = Close ;

double Volume3 = Volume ;

// candle 4

double OpenPrice4 = Open ;

double ClosePrice4 = Close ;

double Volume4 = Volume ;

// candle 5

double OpenPrice5 = Open ;

double ClosePrice5 = Close ;

double Volume5 = Volume ;

// candle 6

double OpenPrice6 = Open ;

double ClosePrice6 = Close ;

double Volume6=Volume ;

// candle 7

double OpenPrice7 = Open ;

double ClosePrice7 = Close ;

double Volume7 = Volume ;

// candle 8

double OpenPrice8 =Open ;

double ClosePrice8 =Close ;

double Volume8 =Volume;

// candle 9

double OpenPrice9 = Open ;

double ClosePrice9 = Close ;

double Volume9 = Volume ;

// candle 10

double OpenPrice10 =Open;

double ClosePrice10=Close;

double Volume10=Volume;

pnow =(ClosePricenow - OpenPricenow);

SOT = (pnow / Volumenow)*10000;

p1 = (ClosePrice1 - OpenPrice1);

SOT1= (p1 / Volume1) *10000;

p2 = (ClosePrice2 - OpenPrice2);

SOT2 =(p2/ Volume2) *10000;

p3 =(ClosePrice3 - OpenPrice3);

SOT3 =(p3/Volume3)*10000;

p4=(ClosePrice4 - OpenPrice4);

SOT4=(p4/Volume4)*10000;

p5=(ClosePrice5 - OpenPrice5);

SOT5 =(p5/Volume5)*10000;

p6=(ClosePrice6 - OpenPrice6);

SOT6 =(p6/Volume6)*10000;

p7=(ClosePrice7 - OpenPrice7);

SOT7 =(p7 / Volume7)*10000;

p8 =(ClosePrice8 - OpenPrice8);

SOT8=(p8/Volume8)*10000;

p9 =(ClosePrice9-OpenPrice9);

SOT9 =(p9/Volume9)*10000;

p10 =(ClosePrice10 -OpenPrice10);

SOT10 = (p10/Volume10)*10000;

SOTAV10=(SOT1+SOT2+SOT3+SOT4+SOT5+SOT6+SOT7+SOT8+SOT9+SOT10/100*10);

SOTAV2 = (SOTAV10*2);

if ((SOT>SOTAV2)&&(ClosePrice1<OpenPrice1)&&(ClosePricenow<OpenPrice1)){

CrossedUp = true;

CrossedDown= false;

}

else

if((SOT>SOTAV2)&&(ClosePrice1>OpenPrice1)&&(ClosePricenow>OpenPricenow)){

CrossedUp = false;

CrossedDown = true;

}

if((CrossedUp==true)&&(SignalLabeled!=1)){

CrossUp=Low-Range*1.3;

if(i<=2 && Alerts && !upalert)

{

Alert (Symbol()," ",Period()," M Price UP ");

//SendMail("Buy "+Symbol(),"");

upalert=true;

downalert=false;

}

SignalLabeled = 1;

}

if ((CrossedDown == true) && (SignalLabeled != 2)) {

CrossDown = High + Range*1.3;

if(i<=2 && Alerts && !downalert)

{

Alert (Symbol()," ",Period(),"M Price DOWN ");

//SendMail("Sell "+Symbol(),"");

downalert=true;

upalert=false;

}

SignalLabeled = 2;

}

}

return(0);

}

This is the principle that guild this software:

Speed of trade = (Price Change / Volume) per unit time. = (Open-Close)/tick volume in the default period.

If SoT of current candle is greater than twice the average SoT of the selected period, next candle will be in the same direction of the current candle. (Our signals can be given at the close of the current candle).

Caution: If current candle is followed by same color 2-3 candles, no signal is to be given. As an example: Date E/J(Open) E/J(High) E/J(Low) E/J(Close) Volume(E/J) Direction Price change Speed 11/06/2012 03:56:00 102.456 102.456 102.429 102.429 96 DOWN -0.027 2.81 11/06/2012 03:57:00 102.429 102.429 102.398 102.413 158 DOWN -0.016 1.01 as speed is greater than 1.70 (average of 14 candles), it predicts that next candle will be down. This indicator can be made to look like a speedometer or just the number can appear with the signal on the candle. I think this will help a great deal in making right decisions. The theory behind this is that every rise or fall needs a force or inertia greater than the existing force, so as soon we see or capture such extra force, we can determine the next candle direction and values also.

......................................................................................................................

Mastercash

As I see it will need some run-time testing before doing anything on the code. As soon as the market opens will see what can be done

 

Hello

Could someone help me to add some code to this script.jarroo_level_picker.mq4

This script draws line on the open or close of the candel depends if we drop it under or below half of the candel and I would like it to also draw little arrow under or below that candel to later see on which candel it was used

Thanks in advance.

Files:
 
Andrewsurfer:
Hello

Could someone help me to add some code to this script.jarroo_level_picker.mq4

This script draws line on the open or close of the candel depends if we drop it under or below half of the candel and I would like it to also draw little arrow under or below that candel to later see on which candel it was used

Thanks in advance.

Andrewsurfer

Try this version. It does not add an arrow but adds a bar in the same color as the line color at the bar which candle was used

 
mladen:
Andrewsurfer Try this version. It does not add an arrow but adds a bar in the same color as the line color at the bar which candle was used

I am sorry but I don't see any changes. It is still just the blue line whitout any other signs.

 
Andrewsurfer:
I am sorry but I don't see any changes. It is still just the blue line whitout any other signs.

There is one extra line (as on the picture) and it is created at the bar where you drop the script at

Files:
v_line.gif  36 kb
 
mladen:
There is one extra line (as on the picture) and it is created at the bar where you drop the script at

I hade wrong settings of MT4 chart in the foreground and now is working.

Thanks a lot.

Reason: