Welcome to the MQL4 course - page 8

 

Deal with error's

I am still get in OrderModify error 1 with a new buil 208-210

stringo says

You must insert into your source parameters checking before ModifyOrder function calling.

is this true? i don't trust this guy.

Best Regards

Aquilez

cnt=OrdersTotal()-1;

while(cnt>=0)

{

if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==false) break;

if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) // && Reversed==False)

{

Print("Ticket ",OrderTicket()," modified.");

if (OrderType()==OP_SELL)

{

if (ExitWithOpenOrdersBasedON && myOrderTypetmp==2)

{

PreviousOpenOrders=OpenOrders+1;

ContinueOpening=False;

text = text +"\nClosing all orders .";

Print("Closing all orders.");

//return(0)

}

if (TrailingStop>0)

{

if ((OrderOpenPrice()-OrderClosePrice())>=(TrailingStop*Point+Pips*Point))

{

if (OrderStopLoss()>(OrderClosePrice()+TrailingStop*Point))

{

result=OrderModify(OrderTicket(),OrderOpenPrice(),OrderClosePrice()+TrailingStop*Point,OrderClosePrice()-TakeProfit*Point-TrailingStop*Point,0,Purple);

if(result!=TRUE) Print("LastError = ", GetLastError());

else OrderPrint();

return(0);

}

}

}

}

if (OrderType()==OP_BUY)

{

if (ExitWithOpenOrdersBasedON && myOrderTypetmp==1)

{

PreviousOpenOrders=OpenOrders+1;

ContinueOpening=False;

text = text +"\nClosing all orders.";

Print("Closing all orders.");

//return(0);

}

if (TrailingStop>0)

{

if ((OrderClosePrice()-OrderOpenPrice())>=(TrailingStop*Point+Pips*Point))

{

if (OrderStopLoss()<(OrderClosePrice()-TrailingStop*Point))

{

result=OrderModify(OrderTicket(),OrderOpenPrice(),OrderClosePrice()-TrailingStop*Point,OrderClosePrice()+TakeProfit*Point+TrailingStop*Point,0,ArrowsColor);

if(result!=TRUE) Print("LastError = ", GetLastError());

else OrderPrint();

return(0);

}

}

}

}

}

cnt--;

}

 

newbie

thankyou for the intro.. maybe a few years since you created it but still very useful.

regards

fiaraz

 

Help Needed - Requires an EA Expert

Hello,

I was wondering if anyone can help me - Am making an EA using a custom indicator called " slope-direction-line.mq4 " the indicator represent trend by 2 colors Lime for uptrend and Red for downtrend - So how to identify the EA for Sell or Buy according to the two colors . I have tried the following but it is not working - So if you can help me please do.

if (iCustom(NULL, 0, "slope-direction-line",0) < iCustom(NULL, 0, "slope-direction-line",0))

and here is the link for the indicator https://www.mql5.com/en/forum

Thanks in advance

 
 

Thanks a lot.

 

Thanks A Lot to Coderguru, NewDigital and all friends for teaching me very usefull education, hope some day with all my afford, i will make my own new Mql program. God Bless you all

Regard,

Spanar.

 

how to pass color parameter

dear sir,

I have a problem :how to pass the parameter to user difine function :

example :

CreateObject("Test1",Green);

CreateObject("Test2",C'236,130,0')

CreateObject("Test3",32768 )

void CreateObject(string Name1,int DefineColor)

{

ObjectCreate(Name1,OBJ_LABLEL,WindowFind("Indicato r1"),0,0);

ObjectSetText(Name1,"Testing",12,"Arial Bold:,DefineColor);

1. so how to pass the Color for Green, C'235,130,0,' or 32768

2. in the User define function, what is the type of the color? can be string ? int? double or color ? I have try but failed

3. what is the type variable for color, or can be convert from interger, string into color type variable ?

4. can you show me the url for this kind of problem.

thanks for the help

rgds bob

 

help.....help.........help...............help

hi

can you help me to use this indicator code

iMAOnArray(?????,?????,?????,????,??????,i);

please with example

thank you for you

 
mercury_man:
hi

can you help me to use this indicator code

please with example

thank you for you

Hello,

I've moved your post to this thread. Take a look at posts 20#.

Meanwhile:

double iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift)Calculation of the Moving Average on data stored in a numeric array. Unlike iMA(...), the iMAOnArray function does not take data by symbol name, timeframe, the applied price. The price data must be previously prepared. The indicator is calculated from left to right. To access to the array elements as to a series array (i.e., from right to left), one has to use the ArraySetAsSeries function. Parameters:

array[] - Array with data. total - The number of items to be counted. 0 means whole array. period - Averaging period for calculation. ma_shift - MA shift ma_method - MA method. It can be any of the Moving Average method enumeration value. shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). Sample:

double macurrent=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,0);

double macurrentslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,0);

double maprev=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,1);

double maprevslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,1);

//----

if(maprev=macurrentslow)

Alert("crossing up");

 

iMAOnArray

iMAOnArray is not an indicator but a function that calculates the moving average of an array!

If you search my lessons you will find the answer and more details about the iMAOnArray.

mercury_man:
hi

can you help me to use this indicator code

please with example

thank you for you