Ask! - page 58

 

The stoploss and takeprofit parameters to OrderSend are "price values" and not pips. Try using "Ask-stoploss*Point" and "Ask+takeprofit*Point" instead; when it comes to EA writing, not only the trend is your friend, but so is the manual ;-)

 
ralph.ronnquist:
The stoploss and takeprofit parameters to OrderSend are "price values" and not pips. Try using "Ask-stoploss*Point" and "Ask+takeprofit*Point" instead; when it comes to EA writing, not only the trend is your friend, but so is the manual ;-)

Ralph,

Thank you very much for your patient and polite responses. I know the mistakes were really dumb ones. As a beginner I didn't know where to begin when the EA passed muster with compiler, and the Strategy Tester said it loaded successfully, but would not produce any results.

Prior to posting my request I had actually tried something close (but obviously not correct) to what is in the manual. That earlier version passed muster with the compiler, but the Stategy Tester rejected the OrderSend syntax. So I looked at the OrderSend statement in the EA that I had made some mods to, to see its syntax. That's where I derived the bad syntax. What I now understand is the author of that EA prefined "stoploss" and "takeprofit" using the correct syntax before the OrderSend statement is executed.

Have some programming experience with Fortran and Basic, but the MQL4 language is challenging for me right now.

Thanks again for your succint and polite responses. They were most helpful.

Raft

BTY Now that the EA runs I can see I have a couple logic errors in the EA as well, but I'll figure those out now that I have the syntax issues behind me.

 

need help with EA coversion

hi everyone,

thumbs up to you guy for having a heart to help. i am trying to convert a straddle ea to script can anyone give me an idea how to go abt it?

thanks in advance

 

some kind of script that monitors the trades until it reaches a preset profit so that as soon as the trades starts coming down after exceeding the preset profit it must close all trades on that currency. But if the profit goes up beyond the preset , it should trail the preset amount not individual trade.

 

I need a script that compare between two prices and finds which one is higher.

for example:

int a1, a2;

a1=1.1111;

a2=1.1112;

if(a1<a2)

{

Print("OK");

}

but this does not , coz the comparing is only for the numbers before the point.

I need to compare the full number with the decimal number.

I hope you understand what I mean, and help me.

 

replace 'int" with "double" like so

double a1, a2;

read documentation about types.

 

Ohhh I forgot about it.

Thank you very much for your help ..

 

Why this returns 0.

iMA(NULL,0,10,-3,MODE_EMA,PRICE_HIGH,1);

Thanks.

 

How to force the start() function to run

Hello,

In an EA, the start() function will be run only if the pair price of attached chart change.

I'd like to know whether it can be run without waiting the price change.

Thanks in advance.

-erkao

 

If you want it to run once.

you can use the init() function which runs at program start.

Thanks.

Reason: