Coding help - page 482

 

Thank you Mladen again for your expert skills - this is exactly what I was looking for. Will offer several uses for it after I test it for a bit. I tip my hat to you once again. Be well

 

BTW - what are those two indicators that are on all of the pics you post, and where would I find them? One looks like a daily candle and the other shows basic chart data. Thanks in advance

 
pipmagnet:
BTW - what are those two indicators that are on all of the pics you post, and where would I find them? One looks like a daily candle and the other shows basic chart data. Thanks in advance

pipmagnet

That is the daily data indicator from here : https://www.mql5.com/en/forum/178698/page7

 

#4793

mladen:
Do you happen to have the original (non-decompiled) source code? If yes, please post that version so that somebody can revise it

sorry it is as is, I don't have the original, where is "Barry Standers"?

the alert code is visible at the end, I thought I could just swap "Alert" for "SendMail" with correct mail format, but no dice.

is this actually because it is decompiled so it won't work?

or is there another issue why you don't like to edit with it?

best regards,

 
zigflip:
#4793

sorry it is as is, I don't have the original, where is "Barry Standers"?

the alert code is visible at the end, I thought I could just swap "Alert" for "SendMail" with correct mail format, but no dice.

is this actually because it is decompiled so it won't work?

or is there another issue why you don't like to edit with it?

best regards,

zigflip

I think it is the best to read this post : https://www.mql5.com/en/forum/183322 (so we shall avoid me repeating myself )

 

Hi mladen. Decided to abandon the ADX thing, but I have a question for you :

The standard Metatrader indicator pack contains an ADX indicator. Bog standard, and it displays ADX,+DI,-DI values in the data window.

Question : Is there a way of dumping the +/- DI values in the data box. I really only need the ADX value displayed.

If there is, could you let me know how?

Many, thanks

 
Jeeves:
Hi mladen. Decided to abandon the ADX thing, but I have a question for you :

The standard Metatrader indicator pack contains an ADX indicator. Bog standard, and it displays ADX,+DI,-DI values in the data window.

Question : Is there a way of dumping the +/- DI values in the data box. I really only need the ADX value displayed.

If there is, could you let me know how?

Many, thanks

Jeeves

You can not change anything with the built in ADX to hide DI+ and DI- values of ADX. It would need to be a custom indicator - we can not change the way how built in indicators are displaying data in the data window

 

Many thanks mladen...appreciate the reply. would you be interested in putting a custom indicator together for me?

 
Jeeves:
Many thanks mladen...appreciate the reply. would you be interested in putting a custom indicator together for me?

Jeeves

You can use this one : https://www.mql5.com/en/forum/173404 and to prevent showing value other than ADX in the data window (and in indicator sub-window too) replace this :

SetIndexLabel(0,"ADX");

SetIndexLabel(1,"+DI");

SetIndexLabel(2,"-DI");

SetIndexLabel(3,"ADXUp");

SetIndexLabel(4,"ADXDown");[/PHP]

with this

[PHP] SetIndexLabel(0,"ADX");

SetIndexLabel(1,NULL);

SetIndexLabel(2,NULL);

SetIndexLabel(3,NULL);

SetIndexLabel(4,NULL);
 

Hi,

Could someone please help me with my LotsizeCalc() function.

I would like to multiply my lotsize with the 'MartingaleAmount' if my last trade was a loser. If my last trade was a winner I would like to use the 'normal' lotsize. Unfortunately, when I backtest the EA I get error 4051 from the journal.

It has something to do with the lotsize, because the EA works when I try to run the EA without the "LotsizeCalc()" function.

Does anyone know why my lotsize function won't work?

Thanks in advance,

Thierry

extern int MaximumTrades = 10; extern double StopLoss=25; extern double TakeProfit=50; extern double MartingaleAmount = 1.5; input double LotSize=0.1; int magic; double pips; int tradeNumber; string ScreenComment; double martinlot; double martinsize;

[/PHP]

[PHP]

double LotsizeCalc() { if(OrderSelect(lastTradeTicket(),MODE_HISTORY)) if(OrderProfit()<0 && tradeNumber 0){ if(OrderSelect(ticket,SELECT_BY_TICKET)){ sl = OrderOpenPrice()+(StopLoss*pips); if(StopLoss==0)sl=0; tp = OrderOpenPrice()-(TakeProfit*pips); if(OrderType()==OP_BUY){ sl = OrderOpenPrice()-(StopLoss*pips); if(StopLoss==0)sl=0; tp = OrderOpenPrice()+(TakeProfit*pips); } if(!OrderModify(ticket,price,sl,tp,0,Magenta)) { err = GetLastError(); Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err) ); } } else{//in case it fails to select the order for some reason Print("Failed to Select Order ",ticket); err = GetLastError(); Print("Encountered an error while seleting order "+(string)ticket+" error number "+(string)err+" "+ErrorDescription(err) ); } } else{//in case it fails to place the order and send us back a ticket number. err = GetLastError(); Print("Encountered an error during order placement!"+(string)err+" "+ErrorDescription(err) ); if(err==ERR_TRADE_NOT_ALLOWED)MessageBox("You can not place a trade because \"Allow Live Trading\" is not checked in your options. Please check the \"Allow Live Trading\" Box!","Check Your Settings!"); } }
Reason: