Coding help - page 521

 

Is there some kind soul (Hint, Hint, Nudge,Nudge) who could add a Stop Loss to the attached Expert...also in monetary value?

Many Thanks.

 
Jeeves:
Is there some kind soul (Hint, Hint, Nudge,Nudge) who could add a Stop Loss to the attached Expert...also in monetary value? Many Thanks.

Try out this one : https://www.mql5.com/en/forum/175843/page10

Set the InitialStop 0, set the TrailOnlyInProfit to true and set the CloseWhenProfit to desired profit (in account currency). You can use some very high time frame for ema so that the trailing stop will be far (but if you set TrailOnlyInProfit to true, trailing stop will be set only when the profit is >0, so you will not have losing trail stops that are close to order open price)

 

Thanks guy.

Only just got home from a meeting. I'll give it a try Friday. My method works well with the one I attached. I trade off a 1 min chart @ £2 a pop & set the expert for five pips...gives me a £100 profit 3,4,5 times a day. I have to be there due to the lack of a stop. So the one you have proposed could be the missing link!

Many, many thanks. I'll let you know how it turns out.

 

Hi Guy...Please don't be offended, but I really prefer the first one. Easier to handle for some-one like me ( A coding idiot!) Would it be possible for you to add a stop loss input in cash to it? The first one that is !

 
Jeeves:
Hi Guy...Please don't be offended, but I really prefer the first one. Easier to handle for some-one like me ( A coding idiot!) Would it be possible for you to add a stop loss input in cash to it? The first one that is !

Will try to make something as as simple as it gets

 

You really a star my friend. Many, many thanks.

 

Percentile Code?

I need code to disregard the top and bottom 'X' percent of values in an array / buffer, so I can average or work with the rest. For example, If I set it to '90' (or maybe '5'), it would discard the top 5% of values and the bottom 5% of values, and use the middle 90%.

Big Be

 
Big Be:
I need code to disregard the top and bottom 'X' percent of values in an array / buffer, so I can average or work with the rest. For example, If I set it to '90' (or maybe '5'), it would discard the top 5% of values and the bottom 5% of values, and use the middle 90%. Big Be

You can do something similar to this :

startElement = (int)percentToIgnore/totalNumebrOfElements;

endElemt = totalNumberOfElements-startElement;

that is in case of arrays - for buffer just invert the start and end element

 

mladen,

That is part of the answer...

I think it would be:

startElement = (int)percentToIgnore *totalNumberOfElements

How do I select the elements to use?

Do I have to order them? How?

Big Be

 
Big Be:
mladen,

That is part of the answer...

I think it would be:

startElement = (int)percentToIgnore *totalNumberOfElements

How do I select the elements to use?

Do I have to order them? How?

Big Be

Depends what do you consider a "%"

If it is position, then you do not have to order them.

If it is values, you have to do order them. One way of getting something similar to that would be this : https://en.wikipedia.org/wiki/Quantile .

Otherwise you would heave to have a double loop : first to determine the values and second to find the values of interest. Double loop is of n^n complexity and if you try to use it on a buffer off the whole history, you are risking terminal freezing

Reason: