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
The CrossPointOfSections() function.
This function calculates the coordinates of the intersection point of two segments. Each segment is defined by a pair of its point coordinates. Three arrays are passed to the function as parameters:
The script is for testing.
Good afternoon. Question about functions that return a flag to close the last position at a take or stop loss.
'Useful functions from KimIV'.
Function isCloseLastPosByTake().
This function returns the flag to close the last position on the take. Flag is up - True - TakeProfit has triggered. Flag lowered - False - position was closed due to other reason
//---------------------------------------------------------------
Yesterday I asked this question on general forum. But so far no answer.
My Expert Advisor has a 3-step martingale. Each step (position) has its own magik (1,2,3).
Positions are closed by signals and/or stops.
This type of closing is also implemented:
It turns out that my Expert Advisor works fine as long as the last (largest position) of a martigail step is not closed at Take Profit!
Then when the next first position (magic 1) is opened, it is closed immediately, because the isCloseLastPosByTake() function flag stays set to one (1) !
And so to infinity. Opens and closes.
Moreover! The terminal remembers this flag and even new removal/installation of the EA does not help (until you change magiks).
I need some way to reset isCloseLastPosByTake() function after all positions are closed.
I've already twisted my brain inside out. It won't work!
Igor !, Or whoever (who can), please tell me how to do it and if you can do it at all ?
The answer to my question seems to have been found. If you're interested, it's right here.
'A question for connoisseurs'.
Examples of how to use the ModifyOrder() function.
I decided to give the very first examples that I've been asked many times before. This is opening of positions in terms of market order execution Market Watch. It is when we cannot simultaneously give an order to open a position at the market price and attach a pending order to it. Such an opening at Market Watch should be performed in two stages: first, we open a position, and then we attach a pending order to it, i.e. we set StopLoss and TakeProfit price levels.
1. Buy 0.1 lot of the current symbol and set a stop of 30 points
2. Sell 0.15 lot of current symbol and set SL=45, TP=99
A working script with examples is included in the trailer.
As long as I didn't put in my EA a magik !
All positions modify normally. However -
I do not understand why but OpenPosition() function does not see the magician and keeps opening positions one by one on every bar. I have already removed all unnecessary things (I thought it was my error in the code).
And put the number of positions in the comment. It is useless. When there are obvious positions - comment prints zero:
I can't figure out why the function can't see the magician! Here's the code:
Attached is the source file of this code. Can you please tell me where I made a mistake and why EA does not see magik?
Yes, thank you all(tmp.0 & Roger)! Fixed it and everything is working as it should.
My inattention is to blame. Not the OpenPosition() function at all.
Player, a hint!
When using OrderCloseBuy - OrderCloseSell, the built-in MKueL language and compiler requires two function parameters(order tickets - buy and sell). We have one ticket for an open order, but how can we set the second one? Or maybe I did not understand something - the language self-study has not written anything about this function and has no example.
Thank you in advance!
And here's another question for Igor.
Have you created a separate custom (or other) function to flip the buy-sell position and vice versa, without the usual OrderClose-OrderSend?