Coding help - page 113

 

Thanks mladen,

Yes I did...works too well! At this point I decided I had no idea what I was doing and went back to trying to make money.

Files:
 
hughesfleming:
Thanks mladen,

Yes I did...works too well! At this point I decided I had no idea what I was doing and went back to trying to make money.

Alex

You simply have all the horizontal lines from all the crosses visible. Maybe you should simply limit the cross showing to only the last cross (remove the "+Time" from the name definition, and you will have only one - presumably last - cross visible)

 

MT4 Coding Improvement

Can Somebody Help me Making This Codes Work Properly?

Hi,I have a challenge making the MT4 code below to work well for my clients.

I want the buy and sell part to work so that the alerts will not be repeating itself at every tick or at the

beginning of each new candle.

Also I want the stop buy and sell alert to work so that when the conditions are met according to the code,

the alerts will sound to stop the trade.

pls click on the code image to enlarge.

Files:
mt4code.png  28 kb
 

Thanks mladen, that is much better and the lines are showing up in the object list with the correct values.

regards,

Alex

 
gringoh:
Dear coders,

I have used the following code from another indicator in order to display the pips count of open orders.

On demo accounts the indicator is working fine but on live accounts the indicator is not working. Any help would be much appreciated.

Many thanks in advance.

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

//| ! - i-Pips count.mq4 |

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

// Indicator properties

#property indicator_chart_window

extern bool Corner_of_Chart_RIGHT_TOP = TRUE;

extern int Shift_UP_DN = 0;

extern int Adjust_Side_to_side = 0;

extern color CommentLabel_color = Orange;

extern color Spread_color = Gold;

int g_order_total_120 = 0;

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

//| Custom indicator initialization function |

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

int init() {

return (0);

}

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

//| Custom indicator deinitialization function |

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

int deinit() {

ObjectsDeleteAll(0, OBJ_LABEL);

return (0);

}

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

//| Custom indicator start function |

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

int start() {

Show_Trade_Pips ();

return (0);

}

//-----------------------------------------------------------------------------

// function: Show_Trade_Pips()

// Description: Pips count per open order

//-----------------------------------------------------------------------------

void Show_Trade_Pips(){

double ld_0 = 0;

int pos_8 = 0;

int count_12 = 0;

int order_total_16 = 0;

//if (Show_Trade_Pips == TRUE) {

order_total_16 = OrdersTotal();

g_order_total_120 = order_total_16;

count_12 = 0;

for (pos_8 = 0; pos_8 < order_total_16; pos_8++) {

OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES);

if (Symbol() == OrderSymbol()) {

if (OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT || OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT) continue;

count_12++;

if (OrderType() == OP_BUY) {

if (Digits == 2 || Digits == 4) ld_0 = (OrderClosePrice() - OrderOpenPrice()) / Point;

if (Digits == 3 || Digits == 5) ld_0 = (OrderClosePrice() - OrderOpenPrice()) / Point / 10.0;

ObjectCreate("BPTrade_lbl" + pos_8, OBJ_LABEL, 0, 0, 0);

ObjectSetText("BPTrade_lbl" + pos_8, "Trade " + count_12 + " Pips ", 10, "Arial", CommentLabel_color);

ObjectSet("BPTrade_lbl" + pos_8, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);

ObjectSet("BPTrade_lbl" + pos_8, OBJPROP_XDISTANCE, Adjust_Side_to_side + 58);

ObjectSet("BPTrade_lbl" + pos_8, OBJPROP_YDISTANCE, 15 * count_12 + 1 + Shift_UP_DN);

ObjectCreate("BPTrade_val" + pos_8, OBJ_LABEL, 0, 0, 0);

ObjectSetText("BPTrade_val" + pos_8, DoubleToStr(ld_0, 1), 10, "Arial Bold", Spread_color);

ObjectSet("BPTrade_val" + pos_8, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);

ObjectSet("BPTrade_val" + pos_8, OBJPROP_XDISTANCE, Adjust_Side_to_side + 10);

ObjectSet("BPTrade_val" + pos_8, OBJPROP_YDISTANCE, 15 * count_12 + 1 + Shift_UP_DN);

continue;

}

if (OrderType() == OP_SELL) {

if (Digits == 2 || Digits == 4) ld_0 = (OrderOpenPrice() - OrderClosePrice()) / Point;

if (Digits == 3 || Digits == 5) ld_0 = (OrderOpenPrice() - OrderClosePrice()) / Point / 10.0;

ObjectCreate("BPTrade_lbl" + pos_8, OBJ_LABEL, 0, 0, 0);

ObjectSetText("BPTrade_lbl" + pos_8, "Trade " + count_12 + " Pips ", 10, "Arial", CommentLabel_color);

ObjectSet("BPTrade_lbl" + pos_8, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);

ObjectSet("BPTrade_lbl" + pos_8, OBJPROP_XDISTANCE, Adjust_Side_to_side + 58);

ObjectSet("BPTrade_lbl" + pos_8, OBJPROP_YDISTANCE, 15 * count_12 + 1 + Shift_UP_DN);

ObjectCreate("BPTrade_val" + pos_8, OBJ_LABEL, 0, 0, 0);

ObjectSetText("BPTrade_val" + pos_8, DoubleToStr(ld_0, 1), 10, "Arial Bold", Spread_color);

ObjectSet("BPTrade_val" + pos_8, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);

ObjectSet("BPTrade_val" + pos_8, OBJPROP_XDISTANCE, Adjust_Side_to_side + 10);

ObjectSet("BPTrade_val" + pos_8, OBJPROP_YDISTANCE, 15 * count_12 + 1 + Shift_UP_DN);

}

}

}

}

gringoh

Do you happen to have the original code?

That is a decompiled code

 

Hi Mladen,

Indeed, I think it is a decompile code. I found this indi on anther forum and tried to modify it in order for it to work live but without any success.

I understand the issue. Sorry for the inconvenience, post edited and deleted.

Best,

 

Dear coders,

I have used the following code from another indicator in order to display the pips count of open orders.

On demo accounts the indicator is working fine but on live accounts the indicator is not working. Any help would be much appreciated.

Many thanks in advance.

 

invalid integer number as parameter 5 for 'iCustom' function

i get this error:

invalid integer number as parameter 5 for 'iCustom' function

function call `code is:

double EUF = iCustom(Symbol(),0,"TOTAL-SHIT-CORREL","EURUSD.pro","USDCHF.pro",0);

TOTAL-SHIT-CORREL takes 2 inputs Pair1 and Pair2 of string type

help

`

 
junglelion:
i get this error:

invalid integer number as parameter 5 for 'iCustom' function

function call `code is:

double EUF = iCustom(Symbol(),0,"TOTAL-SHIT-CORREL","EURUSD.pro","USDCHF.pro",0);

TOTAL-SHIT-CORREL takes 2 inputs Pair1 and Pair2 of string type

help

`

junglelion

It means that "USDCHF.pro" should be in fact some integer and not that string

 

Dear Mladen;

can you convert this indic to EA? (for just long and short, no TP or SL)

Thank you

Files:
_test.mq4  2 kb
Reason: