Forum

I need to understand this please

I have global variable that is used in function, then I use script to test the function result using the alert function Alert("Variable","Function()); Alert(" Function ()","Variable"); but when I alert the result of the function and the global variable the result differs if I mention the variable

ObjectGetValueByShift

Hello everyone. I am trying to code buy order execution when the Bid reach above a price that ObjectGetValueByShift will get the object is a Trendline double Price = ObjectGetValueByShift( "Trendline" , 0 ); if ( Bid >= Price) { int Ticket_Number1= OrderSend ( Symbol (),OP_BUY

My Code Compiled correctly but I have a problem with it

I was trying to code my own EA and created some custom function, the issue that I am facing is as if the custom function that I have is not being read in the EA if the variable that I have assigned this function to is initialized with -1 although when I change that variable to zero, it works fine

My EA is running very slow on MT4 Tester

My EA is operating very slow on MT4 Tester, it contains loops and nested loops, I do not know if that would slow it down that much, Can I save the data of the loops in functions in array and would that make a difference in speed of the tester? thanks

the code compiled correctly, but something when wrong

I have five orders on the chart, I am making a loop to select order to make some modification, it did not work so I print the order ticket along with its index to check, and I have noticed this when these 2 line where here the it prints as follows for(int i=0; i<OrdersTotal(); i++) {

Can "return" operator exit loop in user-defined function and return the required value?

Can "return" operator exit loop in user-defined function and return the required value? or there is no way but to use "break" operator to exit the loop and then "return" operator to terminate the function and get the required value? Thanks

Need help to understand this please

I need some advice for the below code if you please, 1- for some reason, I get a note of " array out of range " in Mt4 expert journal 2- although Period_MA is external variable and I set it to 20; but when I am testing my code by changing for (x=i; x<i+Period_MA; x++) to for (x=i; x<=i+Period_MA ;

I need help with my function please

double Recent_TD_Point[]; for ( int i= 0 ;i< 3000 ;i++) { if (High_TD_Point_Value(i)> 0 ){ Recent_TD_Point[i]=High_TD_Point_Value(i); Print (Recent_TD_Point[i]); } } //------------------------------------------------------------------------------ double

What does “warning: not all control paths return a value” mean? as I received this error after compiling

int TradeEntry( int Type){ if (Type == 0 ){ double BTP = Ask + (TakeProfit * Point ); double BSL = Ask - (StopLoss * Point ); if ( OrderSend ( Symbol (),OP_BUY, 0.1 ,Ask, 10 ,BSL,BTP, NULL , 0 , 0 , clrBlue )){ return true ;} else { return