Coding help - page 394

 

mladen

any suggestions for most efficient dll using microsoft visual studio?

 
Jeeves:
Would I be pushing my luck if I asked for a wav. sound alert, but ONLY when all five are 'in a line'? Users choice of sound input

I guess I got the reply I deserve....I've been in this game long enough to know better.

All I had to do was place my Wav. file in the > options > alert box, & job done. Sorry Mladen for being that stupid, & credit to you for forcing me to think it out

 
Jeeves:
I guess I got the reply I deserve....I've been in this game long enough to know better. All I had to do was place my Wav. file in the > options > alert box, & job done. Sorry Mladen for being that stupid, & credit to you for forcing me to think it out

Don't worry

Weekend is not a time for serious brainstorming

 

Hi everyone, I need some help and please if can someone, help me :/

So, I want to check my total orders and colorized their backgrounds like odd and even.

Like this

But my problem is last one label :/ in this picture, my total orders is 5 but labels is 6 :/

This is my code:

int ticket1 = OrdersTotal();

int a_ticket1[];

ArrayResize( a_ticket1, ticket1 );

for (int cnt1=0;cnt1<ticket1;cnt1++)

{

if ( !OrderSelect(cnt1,SELECT_BY_POS,MODE_TRADES) ) continue;

a_ticket1[cnt1]=OrderTicket();

int orcol;

if(ExtLines<0)

{

for(orcol=0; orcol<9; orcol++)

{

string OrderNumber1 = "Orders Background " +cnt1/2+orcol;

string OrderNumbert1 = "Orders Backgrnds " +cnt1/2+orcol;

if(ObjectCreate(OrderNumber1,OBJ_LABEL,0,0,0))

{

string Ydistanc1 = 65 + (24 * cnt1);

ObjectSetText(OrderNumber1, Obg[orcol], 15, "Acc_info", Gray);

ObjectSet(OrderNumber1, OBJPROP_CORNER, 0);

ObjectSet(OrderNumber1, OBJPROP_XDISTANCE, Obgs[orcol]);

ObjectSet(OrderNumber1, OBJPROP_YDISTANCE, Ydistanc1);

}

if(ObjectCreate(OrderNumbert1,OBJ_LABEL,0,0,0))

{

string Ydistanct1 = 89 + (24 * cnt1);

ObjectSetText(OrderNumbert1, Obg[orcol], 15, "Acc_info", DarkGray);

ObjectSet(OrderNumbert1, OBJPROP_CORNER, 0);

ObjectSet(OrderNumbert1, OBJPROP_XDISTANCE, Obgs[orcol]);

ObjectSet(OrderNumbert1, OBJPROP_YDISTANCE, Ydistanct1);

}

}

}

}

Thanks in advance and sorry for my bad English

Files:
 

Dear Coders

Need your help

Attach indicator works nice but if levels are set to " 0 & 100 ", color on histo (center line) does not change !

Is it possible to make it working with those levels too !

Thanks for any help

secretcode

 
secretcode:
Dear Coders

Need your help

Attach indicator works nice but if levels are set to " 0 & 100 ", color on histo (center line) does not change !

Is it possible to make it working with those levels too !

Thanks for any help

secretcode

secretcode

The value of the RSX has to be greater than or less than the level values. Try using 99.9999 and 0.0001 instead of 100 and 0

 
mladen:
secretcode The value of the RSX has to be greater than or less than the level values. Try using 99.9999 and 0.0001 instead of 100 and 0

Thank you very much Mladen for help

Best Regards,

secretcode

 

Hi Mr Mladen, how are you? Can you help me please?

iam developìng my own indicator based on support and resistance breackout.

I have it allmost ready, but are 32 things i don't know where to insert into the code or write it better.

1.- first thing is to make the first order Buy after sell to paint in another color, in this case color Lime, and the first Sell after buy in color red.

2.- To make that the indicator deploy a Pop up with a text for this order in different color saying "pair .... going long" and "pair.... going short".

3.- to include the code of those fractals indicator into my code to let everything stick together...

this is what i have until now for my indicator:

#property strict

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 clrLime

#property indicator_color2 clrRed

#property indicator_color3 clrMagenta

#property indicator_color4 clrCyan

#define BUY 1

#define SELL 2

double Buy[],

Sell[],

FirstBuy[],

FirstSell[];

int OnInit() {

SetIndexBuffer(0,FirstBuy);

SetIndexBuffer(1,FirstSell);

SetIndexBuffer(2,Buy);

SetIndexBuffer(3,Sell);

for(int i=0; i<4; i++) {

SetIndexStyle (i,DRAW_ARROW,STYLE_SOLID,2);}

SetIndexArrow (0,233);

SetIndexArrow (1,234);

SetIndexArrow (2,233);

SetIndexArrow (3,234);

return(INIT_SUCCEEDED);}

void OnDeinit(const int reason) {}

int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[],

const double &open[], const double &high[], const double &low[],

const double &close[], const long &tick_volume[], const long &volume[],

const int &spread[]) {

static int lastSignal=0;

for(int i=MathMin(rates_total-prev_calculated, rates_total-1); i>=0; i--) {

FirstBuy=FirstSell=Buy=Sell=EMPTY_VALUE;

datetime when=Time;

int x=iBarShift(NULL,PERIOD_H1, when),

y=iBarShift(NULL,PERIOD_M15,when),

z=iBarShift(NULL,PERIOD_M5, when);

double srUpH1 = iCustom(NULL,PERIOD_H1,"Support and Resistance (Barry)",0,x),

srDownH1 = iCustom(NULL,PERIOD_H1,"Support and Resistance (Barry)",1,x),

MidH1 = (srUpH1+srDownH1)/2,

srUp15M = iCustom(NULL,PERIOD_M15,"Support and Resistance (Barry)",0,y),

srDown15M = iCustom(NULL,PERIOD_M15,"Support and Resistance (Barry)",1,y),

Mid15M = (srUp15M+srDown15M)/2,

srUp5M = iCustom(NULL,PERIOD_M5,"Support and Resistance (Barry)",0,z),

srDown5M = iCustom(NULL,PERIOD_M5,"Support and Resistance (Barry)",1,z),

Mid5M = (srUp5M+srDown5M)/2,

srUp = iCustom(NULL,0,"Support and Resistance (Barry)",0,i),

srDown = iCustom(NULL,0,"Support and Resistance (Barry)",1,i);

if(ClosesrUp) {

if(lastSignal==SELL) {

FirstBuy=Low-_Point;

SoundAlert(when,"Buy");}

else {

Buy=Low-_Point; }

lastSignal=BUY;}

if(Close>srUpH1 && Close<srDown) {

if(lastSignal==BUY) {

FirstSell=High+_Point;

SoundAlert(when,"Sell");}

else {

Sell=High+_Point; }

lastSignal=SELL;}}

return(rates_total);}

void SoundAlert(datetime i, string dir) {

static datetime lastAlert=0;

if(lastAlert!=i) {

Alert(StringFormat("%s signal on %s at %s",dir,Symbol(),TimeToStr(i)));

lastAlert=i;}}

this are the code of hte fractals for support and resistance i dont know where to input:

[TD="class: bb-bot, width: 100%"] [TD="class: bb-right-bot, width: 4"]thanks
#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue

//---- buffers

double v1[];

double v2[];

double val1;

double val2;

int i;

int init()

{

IndicatorBuffers(2);

//---- drawing settings

SetIndexArrow(0, 119);

SetIndexArrow(1, 119);

SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red);

SetIndexDrawBegin(0,i-1);

SetIndexBuffer(0, v1);

SetIndexLabel(0,"Resistance");

SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1,Blue);

SetIndexDrawBegin(1,i-1);

SetIndexBuffer(1, v2);

SetIndexLabel(1,"Support");

return(0);

}

int start()

{

i=Bars;

while(i>=0)

{

val1 = iFractals(NULL, 0, MODE_UPPER,i);

if (val1 > 0)

v1=High;

else

v1 = v1;

val2 = iFractals(NULL, 0, MODE_LOWER,i);

if (val2 > 0)

v2=Low;

else

v2 = v2;

i--;

}

return(0);

}

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

[/TD]
[/TD]

[/TR]

[TR]

 
daniel1983:
Hi Mr Mladen, how are you? Can you help me please?

iam developìng my own indicator based on support and resistance breackout.

I have it allmost ready, but are 32 things i don't know where to insert into the code or write it better.

1.- first thing is to make the first order Buy after sell to paint in another color, in this case color Lime, and the first Sell after buy in color red.

2.- To make that the indicator deploy a Pop up with a text for this order in different color saying "pair .... going long" and "pair.... going short".

3.- to include the code of those fractals indicator into my code to let everything stick together...

this is what i have until now for my indicator:

#property strict

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 clrLime

#property indicator_color2 clrRed

#property indicator_color3 clrMagenta

#property indicator_color4 clrCyan

#define BUY 1

#define SELL 2

double Buy[],

Sell[],

FirstBuy[],

FirstSell[];

int OnInit() {

SetIndexBuffer(0,FirstBuy);

SetIndexBuffer(1,FirstSell);

SetIndexBuffer(2,Buy);

SetIndexBuffer(3,Sell);

for(int i=0; i<4; i++) {

SetIndexStyle (i,DRAW_ARROW,STYLE_SOLID,2);}

SetIndexArrow (0,233);

SetIndexArrow (1,234);

SetIndexArrow (2,233);

SetIndexArrow (3,234);

return(INIT_SUCCEEDED);}

void OnDeinit(const int reason) {}

int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[],

const double &open[], const double &high[], const double &low[],

const double &close[], const long &tick_volume[], const long &volume[],

const int &spread[]) {

static int lastSignal=0;

for(int i=MathMin(rates_total-prev_calculated, rates_total-1); i>=0; i--) {

FirstBuy=FirstSell=Buy=Sell=EMPTY_VALUE;

datetime when=Time;

int x=iBarShift(NULL,PERIOD_H1, when),

y=iBarShift(NULL,PERIOD_M15,when),

z=iBarShift(NULL,PERIOD_M5, when);

double srUpH1 = iCustom(NULL,PERIOD_H1,"Support and Resistance (Barry)",0,x),

srDownH1 = iCustom(NULL,PERIOD_H1,"Support and Resistance (Barry)",1,x),

MidH1 = (srUpH1+srDownH1)/2,

srUp15M = iCustom(NULL,PERIOD_M15,"Support and Resistance (Barry)",0,y),

srDown15M = iCustom(NULL,PERIOD_M15,"Support and Resistance (Barry)",1,y),

Mid15M = (srUp15M+srDown15M)/2,

srUp5M = iCustom(NULL,PERIOD_M5,"Support and Resistance (Barry)",0,z),

srDown5M = iCustom(NULL,PERIOD_M5,"Support and Resistance (Barry)",1,z),

Mid5M = (srUp5M+srDown5M)/2,

srUp = iCustom(NULL,0,"Support and Resistance (Barry)",0,i),

srDown = iCustom(NULL,0,"Support and Resistance (Barry)",1,i);

if(ClosesrUp) {

if(lastSignal==SELL) {

FirstBuy=Low-_Point;

SoundAlert(when,"Buy");}

else {

Buy=Low-_Point; }

lastSignal=BUY;}

if(Close>srUpH1 && Close<srDown) {

if(lastSignal==BUY) {

FirstSell=High+_Point;

SoundAlert(when,"Sell");}

else {

Sell=High+_Point; }

lastSignal=SELL;}}

return(rates_total);}

void SoundAlert(datetime i, string dir) {

static datetime lastAlert=0;

if(lastAlert!=i) {

Alert(StringFormat("%s signal on %s at %s",dir,Symbol(),TimeToStr(i)));

lastAlert=i;}}

this are the code of hte fractals for support and resistance i dont know where to input:

[TD="class: bb-bot, width: 100%"] [TD="class: bb-right-bot, width: 4"]thanks
#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue

//---- buffers

double v1[];

double v2[];

double val1;

double val2;

int i;

int init()

{

IndicatorBuffers(2);

//---- drawing settings

SetIndexArrow(0, 119);

SetIndexArrow(1, 119);

SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red);

SetIndexDrawBegin(0,i-1);

SetIndexBuffer(0, v1);

SetIndexLabel(0,"Resistance");

SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1,Blue);

SetIndexDrawBegin(1,i-1);

SetIndexBuffer(1, v2);

SetIndexLabel(1,"Support");

return(0);

}

int start()

{

i=Bars;

while(i>=0)

{

val1 = iFractals(NULL, 0, MODE_UPPER,i);

if (val1 > 0)

v1=High;

else

v1 = v1;

val2 = iFractals(NULL, 0, MODE_LOWER,i);

if (val2 > 0)

v2=Low;

else

v2 = v2;

i--;

}

return(0);

}

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

[/TD]
[/TD]

[/TR]

[TR]

daniel1983

points 2 and 3 now:

2. Simply add Alert(t"text to use for popup window") to have a popup alert

3. Not a good idea - makes the code overcomplicated and increases the possibility of something working wrong

 

Dear Mladen

Is it possible to 'add band' in attached indicator like in this post : https://www.mql5.com/en/forum/172894/page45

That indicator is from elite section but I like the way how you add band on it

Thanks for any help

secretcode

Reason: