You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Need hand regading STOPLOSS
kemal44
Here is a link to a thread where it is explained how to use functions in code : https://www.mql5.com/en/forum/173005
It is explained very good there (and more than I can explain in one post) how to use themDear Mladen ,
when backtesting ,BreakEven-Stoplos seems working but when the real account , as far as I see that it doesnt work properly ,
would you mind taking a look an expert file, and then tell me what's wrong with it?
thanks in advance
...
kemal
Check in the experts tab of terminal what error is written out.
I can not check it since it is missing the entry logic (it never sets BuyCondition or SellCondition to true the way it is written)
Dear Mladen ,
when backtesting ,BreakEven-Stoplos seems working but when the real account , as far as I see that it doesnt work properly ,
would you mind taking a look an expert file, and then tell me what's wrong with it?
thanks in advancekemal
Check in the experts tab of terminal what error is written out.
I can not check it since it is missing the entry logic (it never sets BuyCondition or SellCondition to true the way it is written)here is the expert with buy sell logic ,
problem is breakeven stop-loss .
What I wanna to do by breakeven is that if profit jump up 5 pip from entry point ,stop-loss should be set to entry point in order to protect portfolio ,
thanks in advance
...
Since the minimal distance of the stop loss depends from symbol to symbol, from broker to broker and can vary from one moment to another, before setting the break even, add a check that would go something like this (this is a generic example when an order is a buy order, you can write it very similar to sell order) :
if (OrderType()=OP_BUY && (Bid-OrderOpenPrice())>=minimalDistance)
... your code for setting stop loss
PS: this is all valid (according to latest changes - from build 419 upwards) in cases when you broker is not an ECN broker. If your broker is an ECN broker in that case MarketInfo(Symbol(),MODE_STOPLEVEL) will return 0 in latest builds and you will have to do some experimenting to adjust the minimal distance (if there is one) of the stop loss
here is the expert with buy sell logic ,
problem is breakeven stop-loss .
What I wanna to do by breakeven is that if profit jump up 5 pip from entry point ,stop-loss should be set to entry point in order to protect portfolio ,
thanks in advanceSince the minimal distance of the stop loss depends from symbol to symbol, from broker to broker and can vary from one moment to another, before setting the break even, add a check that would go something like this (this is a generic example when an order is a buy order, you can write it very similar to sell order) :
if (OrderType()=OP_BUY && (Bid-OrderOpenPrice())>=minimalDistance)
... your code for setting stop loss
thank you ;
Distance is nice idea ,
I have no idea about ECN Broker rules, my broker is local company
...
kemal44
Of your broker - try the following : a simple way to check is to try to open an order manually but when you do that try setting stop loss and / or take profit. If those fields are disabled (like on the picture bellow) in the open order dialog or whatever value except 0 you set in those you get an error then your broker is an "ECN / STP" type of broker
thank you ;
Distance is nice idea ,
I have no idea about ECN Broker rules, my broker is local companykemal44
Of your broker - try the following : a simple way to check is to try to open an order manually but when you do that try setting stop loss and / or take profit. If those fields are disabled (like on the picture bellow) in the open order dialog or whatever value except 0 you set in those you get an error then your broker is an "ECN / STP" type of broker
My trading windows is the exactly same as above pic .I undurstood my borker is type of "ECN / STP" .
thank you
in the meantime , Can we get channels(StdDev etc..) provided by MT4 automaticly in our chart by the indicator or ea based code ,I have no idea how to code it , would you mind helping me to get sample code for that?
thanks in advance
...
kemal44
I am not sure if I understand the question about the "channels", but let me try :
You can use any metatrader built in indicator using functions they provided. For standard deviation for example the syntax is the following:
[/TD]
[/TR]
[/TABLE]
Calculates the Standard Deviation indicator and returns its value. Parameters:
[TABLE="class: docparams"]
[/TR]
[/TR]
[/TR]
[TR]
[TR]
[TD]ma_method
[TD] - [TD="width: 100%"]MA method. It can be any of Moving Average method enumeration value.[TR]
[TD]applied_price [TD] - [TD="width: 100%"]Applied price. It can be any of Applied price enumeration values.[TR]
[TD]shift [TD] - [TD="width: 100%"]Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).Sample:
double val=iStdDev(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,0);_________________________________________
Similar is for other built in indicators (these ones :So you can use any of those as a function call from another indicator, script or EA
If You meant to display some of the built in indicators values on chart, then you have to use a drawing buffer (like in regular indicators) assign values of some of the above functions to the drawing buffer and it will be displayed on chart. EAs do not have drawing buffers, so you can not do that using drawing buffers from an EA (you would need to use objects, but that is a completely different story)
My trading windows is the exactly same as above pic .I undurstood my borker is type of "ECN / STP" .
thank you
in the meantime , Can we get channels(StdDev etc..) provided by MT4 automaticly in our chart by the indicator or ea based code ,I have no idea how to code it , would you mind helping me to get sample code for that?
thanks in advancekemal44
I am not sure if I understand the question about the "channels", but let me try :
You can use any metatrader built in indicator using functions they provided. For standard deviation for example the syntax is the following:
[/TR]
[/TABLE]
Calculates the Standard Deviation indicator and returns its value. Parameters:
[TABLE="class: docparams"]
[/TR]
[/TR]
[/TR]
[TR]
[TR]
[TD]ma_method [TD] - [TD="width: 100%"]MA method. It can be any of Moving Average method enumeration value.[TR]
[TD]applied_price [TD] - [TD="width: 100%"]Applied price. It can be any of Applied price enumeration values.[TR]
[TD]shift [TD] - [TD="width: 100%"]Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).Sample:
double val=iStdDev(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,0);_________________________________________
Similar is for other built in indicators (these ones :So you can use any of those as a function call from another indicator, script or EA
If You meant to display some of the built in indicators values on chart, then you have to use a drawing buffer (like in regular indicators) assign values of some of the above functions to the drawing buffer and it will be displayed on chart. EAs do not have drawing buffers, so you can not do that using drawing buffers from an EA (you would need to use objects, but that is a completely different story)What I mean by Sdv Channel is the channel like as below ,
by the way , thank you for promp response.
EA with Parabolic SAR
Have some one idea trading with parabolic SAR. I want make EA with Parabolic SAR but until now I don't get good result. So If you have Idea with Parabolic SAR I will make it better. The last I make it can make that profit. but Equity never same with balance.