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
But it allows to stop the Expert Advisor by pressing the "Expert Advisors" button on the toolbar.
I think it will do, thank you. There are not too many parameters to leave the EA, it won't be hard
An example of using the ClosePosBySizeProfitInCurrency() function
Especially to demonstrate the ClosePosBySizeProfitInCurrency() function, I have written an Expert Advisor
e-CloseByProfitPosInCurrency, which closes only those positions where the profit in the deposit currency exceeds a certain specified value. The Expert Advisor can be installed on only one chart or on several ones. You can specify a list of positions to be closed using external parameters of the Expert Advisor:
Good afternoon to all.
Do you, Igor, have a function that closes lossy positions in a similar way to ClosePosBySizeProfitInCurrency() when a specified loss is reached. (Or, perhaps, a combined one, where one can specify closing on profit and on loss).
As I understand it, we can simply set in parameters pr for OrderProfit() - with minus sign and we will get what we are looking for.
Is it possible to set the threshold in points (not in deposit currency) ? If yes, then how ? (TakeProfit and StopLoss are not suggested)
Do you, Igor, have a function that closes lossy positions in a similar way to ClosePosBySizeProfitInCurrency() when a specified loss is reached. (Or perhaps a combined one, where you can specify closing on profit and on loss.)
No, I don't have such a function yet. However, you can re-do ClosePosBySizeProfitInCurrency():
I made it so that loss can be passed as a positive (loss) and negative (profit with a minus sign) number.
As I understand it, we can just set in parameters pr for OrderProfit() - with minus sign and we will get what we are looking for.
Is it possible to set the threshold in points (and not in the deposit currency) ? If yes, how ? (Take Profit and Stop Loss are not an option)
Look at the code of e-CloseByProfit.
The ClosePositions() function.
This function closes positions whose parameters meet the specified values:
The ClosePosFirstProfit() function.
This function closes positions in a certain order, i.e. profitable positions first, followed by all other positions. A more accurate selection of positions to be closed is defined by external parameters:
The ClosePosWithMaxProfitInCurrency() function.
This function closes one position with the maximum positive profit in the deposit currency. That is, out of five positions, each of which has a profit of -34, 15, 73, -90, 41, the position with a profit of 73 units in the deposit currency will be closed. A more accurate selection of positions to be closed is specified using external parameters:
If the CCI value is above 100, then open a buy position until the value is below -100 and when it is below -100, then open a sell position until it is above 100.
For you, Dima, I can suggest this function:
This function returns 1 when to buy and -1 when to sell. The buy/sell conditions are as you want them to be. All you need to do now is for each tick to do the following:
1. Get the value of GetTradeSignal().
2. If the received value =0, then do nothing.
If the received value >0, then close all sales and buy.
4. If the obtained value is <0, then close all purchases and sell.