help with ea

 
........
 
mmee55: closing by percentage..learn how to put it together by what i could search, compiles no errors or warnings, but won't do its job.

And what job would that be?

Showing us the code that "does not do the job" but not explaining what that job is or what you expect it to do, serves no purpose.

How can we help you if we don't know what you are expecting?

We cannot read your mind, so please elaborate on your requirements, hopefully more clearly and in detail.

EDIT: And please format/style your code properly before posing so that it will be easier to read. Use MetaEditor's Styler Tool.

 
mmee55: It's Job is meant to close if the current position drops by say 30%, basically like a trailing stop but in percentage and it won't trail.. it'll just read that the positions lost 30percent for where it previously was

After a very quick look, just skimming over the code, I noticed this:

double percentageloss = balance/100*percentagerisk*ORDER_PRICE_OPEN;

Unfortunately "ORDER_PRICE_OPEN" is not an actual price (opening or otherwise). It is a constant, a property identifier, from the set of values of the "ENUM_ORDER_PROPERTY_DOUBLE" enumeration to be used with the functions OrderGetDouble() and HistoryOrderGetDouble(). You can't use it in the way you have done.

You also cannot calculate a percentage loss from an opening price, so please explain your calculation in more detail because it does not make sense.

Reason: