Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 210
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 mistake with the magician causes your EA not to see that its position is closed on a stop when closing on a stop. Why? The answer is that you open a position with magic 123 and send the variable Magic to the function that checks for closing the position at the stop. What do you think it equals when initialized implicitly? Zero. The function is naturally searching for positions with magic number 0 and it is equal to 123 in your positions. And we're not arguing, just... ...reasoning... Check the response to close on the stop:
I didn't look at the rest of your "dead" EA logic - I was helping you figure out the stop close check function...
Artem ! Good day! Thanks again for the help.
I have removed all unnecessary "dead" logic and "revived" the remaining ones.... as far as I understand it.
Left only one function, which you have helped me to fix.
But miracles began to happen beyond my comprehension
1. My Expert Advisor opens trades at the beginning of each candle (I have a 5 minute candle)
and ignoring all of the conditions.
I.e. the control enters the first line
double Price=iOpen(Symbol (),0,0);
And then it jumps through 11 lines and gets to the following lines
Lot=0.1;
OrderSend(Symbol(),OP_SELL,1,Bid,Lot,Ask+1500*Point,Ask-300*Point, "jfh",123 );
2. If we remove the line that calculates the minimum lot Lot=MarketInfo(Symbol(), MODE_MINLOT);
The Expert Advisor works fine, but the isCloseLastPosByStop function doesn't work.
I was straining my brain for a long time..... but in vain. I would be grateful if you could tell me where the error is hidden.
solnce600:
Артем ! Добрый день! Еще раз спасибо за помощь.
All my " dead logic" removed unnecessary and "revived" the rest.... as far as I understand it.
I practically left only the function, which you helped me to correct.
But the miracles, which are beyond my understanding, have started to happen.
After
add everything to the body { }
Sorry I'm not Artem.
solnce600:
After
add everything to the body { }
I'm sorry I'm not Artem.
t or Lot ???
solnce600:
After
add everything to the body { }
Sorry I'm not Artem.
Did as you said..... alas advisor works .... the isCloseLastPosByStop function does not work
This is a piece of code from the function bool isCloseLastPosByStop(string sy, int op, int mn, double &ll)
But what if there is a slip in 3 pips? It is not very well thought out ))
You understand - I'm not really bothered about it yet....
I've been trying for a week to figure out why this function doesn't work for me.
I.e. I need the next order to open with a double volume of the order closed at the stop, and the next order to open with a regular volume after the non-stop.
Correct the logic of work, otherwise it will take a long time to think
This is a piece of code from the function bool isCloseLastPosByStop(string sy, int op, int mn, double &ll)
But what if there is a slip in 3 pips? It's not very well thought out ))
You understand - I'm not bothering with it yet....
I haven't understood for a week why this function doesn't work the way I want it to.
I.e. I need to open the next order after the stop with a double volume of the order which closed at the stop, and after the non-stop, the next order is opened with a regular volume.And why touch the order history? Look at the balance - where it went in that direction and change the lot.
If it is only a robot that will trade on your account.
Correct the logic of operation, or it will take a long time to think
I would be very grateful if you could explain "on your fingers" in relation to my example.
What is my faulty logic. I do not understand what I am talking about.
Thank you.