Coding help - page 307

 

But I still don't know why it needs that MACD. I loaded it into my folder and everything works fine, but I didn't see anything about MACD on my chart though.

mladen:
It will work, but since there is no such indicator, it is slowing your PC

See lines 637 through 640 :

HistogramBuffer1_iplus1=iCustom(NULL,0,"Ljp_MACD",2,i+1);

HistogramBuffer1_i=iCustom(NULL,0,"Ljp_MACD",2,i);

HistogramBuffer2_iplus1=iCustom(NULL,0,"Ljp_MACD",3,i+1);

HistogramBuffer2_i=iCustom(NULL,0,"Ljp_MACD",3,i);

As soon as you have that "Ljp_MACD" indicator too, it should start working much faster
 

Oh I know, if I want to see the MACD, I have to load it to the chart seperately. Sorry for being idiot, hehe.

mladen:
It will work, but since there is no such indicator, it is slowing your PC

See lines 637 through 640 :

HistogramBuffer1_iplus1=iCustom(NULL,0,"Ljp_MACD",2,i+1);

HistogramBuffer1_i=iCustom(NULL,0,"Ljp_MACD",2,i);

HistogramBuffer2_iplus1=iCustom(NULL,0,"Ljp_MACD",3,i+1);

HistogramBuffer2_i=iCustom(NULL,0,"Ljp_MACD",3,i);

As soon as you have that "Ljp_MACD" indicator too, it should start working much faster
 
wccmcd:
But I still don't know why it needs that MACD. I loaded it into my folder and everything works fine, but I didn't see anything about MACD on my chart though.

wccmcd

Sorry, by I really can not tell what did the author want to do with that (it is there on the chart just that you don't see it since the values are close to 0). Values calculated by it are not used at all in the indicator

 

I found the author's blog and I will try to contact him. Seems he havn't updated his blog for a long time though.

in his blog he said this indicator can "calculate the histogram's area" -- which means it can add up macd histogram bars and gives a total value of a certain area. I know this value is used by a trading theory in China called "zen theory".

I will keep you updated if I can find the author.

Thanks alot for your help Mladen.

mladen:
wccmcd Sorry, by I really can not tell what did the author want to do with that (it is there on the chart just that you don't see it since the values are close to 0). Values calculated by it are not used at all in the indicator
 

Hi guys, anyone knows what does the "macro redefinition" warning mean in New MT4, and how to get rid of it ? Thanks a lot for the reply.

 
airquest:
Hi guys, anyone knows what does the "macro redefinition" warning mean in New MT4, and how to get rid of it ? Thanks a lot for the reply.

airquest

That means that you have #define someName someValue 2 or more times in the same source

Delete one #define (if they are the same) or give it different name and use different name

 

Help with EA code?

Hi,

Im trying to backtest this martingale EA and i get this error 4051 in the journal, and i can see it

effects up to 50% of orders from opening, when i compiled the code this warning comes up

"return value of 'OrderModify' should be checked Template EA.mq4 265 14"

i have pasted the part of the code below where the warning is, unfortunately i dont know how to code just yet, and wouldnt

have a clue how to fix it.

Anybody can help me with it?

Thanks!

i get error opening order 4051 in my journal, invalid lots amount for order send function

return value of 'OrderModify' should be checked Template EA.mq4 265 14

if (takeprofit!=0)

OrderModify(ticket,OrderOpenPrice(),0,takeprofit,0,CLR_NONE); } }

else { Print(TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)+" | "+EAComment+" | "+" Error opening order : ",GetLastError()); }}

 
ynachum:
Hi,

Im trying to backtest this martingale EA and i get this error 4051 in the journal, and i can see it

effects up to 50% of orders from opening, when i compiled the code this warning comes up

"return value of 'OrderModify' should be checked Template EA.mq4 265 14"

i have pasted the part of the code below where the warning is, unfortunately i dont know how to code just yet, and wouldnt

have a clue how to fix it.

Anybody can help me with it?

Thanks!

i get error opening order 4051 in my journal, invalid lots amount for order send function

return value of 'OrderModify' should be checked Template EA.mq4 265 14

if (takeprofit!=0)

OrderModify(ticket,OrderOpenPrice(),0,takeprofit,0,CLR_NONE); } }

else { Print(TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)+" | "+EAComment+" | "+" Error opening order : ",GetLastError()); }}

ynachum

Error 4051 means that some of the parameters for OrderSend() is having a wrong or not allowed value

Warning that "OrderModify() should be checked" is easily solvable (use something like if (OrderModify()) ...; - but that will not solve your error 4051 - check what parameters are you passing to order send and what are their values)

 
mladen:
ynachum

Error 4051 means that some of the parameters for OrderSend() is having a wrong or not allowed value

Warning that "OrderModify() should be checked" is easily solvable (use something like if (OrderModify()) ...; - but that will not solve your error 4051 - check what parameters are you passing to order send and what are their values)

Hi, thanks for the reply, any chance you can take a look at the code for me if it is easy to solve? i just have no knowledge of coding yet, i am just starting to learn and i really want to use this expert but cant. I attached the file, it would be super helpful!

template_ea.mq4

template_ea.mq4

Files:
template_ea.mq4  11 kb
 
ynachum:
Hi, thanks for the reply, any chance you can take a look at the code for me if it is easy to solve? i just have no knowledge of coding yet, i am just starting to learn and i really want to use this expert but cant. I attached the file, it would be super helpful!

template_ea.mq4

template_ea.mq4

Made some changes in the code and tested it

I did not get that error in backtest (used Alpari for testing) - try it out : template_ea_1.mq4

Files: