- Did you check the log for errors?
- Please correct the call of OrderSend(). Put the cursor on OrderSend(..) and press F1. Then you can see that your "NULLs " are misleading!! Start from using the example in the reference (F1).
1. Yes. No errors.
2. Updated the message and reuploaded EA .
Any idea how to solve the issue? Trying static variable to stop it out with no success.. Gotta be a way.
Think about your logic...
if (sellcount_order()==0) { OrderSend(Symbol(),OP_SELL,.01,NULL,NULL,NULL,NULL,1,1,NULL,NULL); } if (buycount_order()==0) { OrderSend(Symbol(),OP_BUY,.01,NULL,NULL,NULL,NULL,1,1,NULL,NULL); } if (sellcount_order()==1) { OrderSend(Symbol(),OP_BUY,.01,NULL,NULL,NULL,NULL,2,2,NULL,NULL); } if (buycount_order()==1) { OrderSend(Symbol(),OP_SELL,.01,NULL,NULL,NULL,NULL,2,2,NULL,NULL); }
You start off with no orders.
You open a sell (first logic), then you open a buy (second logic),
When the third logic is reached, the sell count == 1 so you open another buy.
The fourth logic never triggers, because buycount == 2 (after the third logic).
At the end of this first run, you have 1 Sell and 2 Buy orders.
On every call thereafter, the third logic opens another buy order. Nothing else triggers.
I got it down.
Did the trick
Thanks a ton
There are latent problems with that code.
OrderMagicNumber() requires an OrderSelect().
It will be using the last orderselect from your sellcount_order() or buycount_order() call. That could be anything.
There are latent problems with that code.
OrderMagicNumber() requires an OrderSelect().
It will be using the last orderselect from your sellcount_order() or buycount_order() call. That could be anything.
I did learn something new from this thread.
If you pass NULL or 0 for price in an OrderSend call, it works.
No need to bother with Bid / Ask, particularly useful when opening orders on other symbols.
Thought I had it, I didnt. Any more thoughts are greatly appreciated.
Tried to fix logic to no avail.
Thought I had it, I didnt. Any more thoughts are greatly appreciated.
Tried to fix logic to no avail.
It might help if we understood your goal more clearly.
Objective: I only need this to produce one buy after there is already one sell already and/or one sell after there is one buy already.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Really need some help here.Ive attached the EA as well as a Screenshot to make it easier to test out if you dont want to copy paste.
Objective: I only need this to produce one buy after there is already one sell already and/or one sell after there is one buy already.
Problem: The following piece of code does not produce the second sell after the first buy, yet it does produce many second buys after the first sell. As you can see, the prerequisite to produce a second buy is that there is already a first sell, and the prerequisite to produce a second sell is that there is already a first buy.
Notice it does produce buys after the initial first sell, which is the prerequisite to place the second buy. Ive tried changing the order and it does affect it however it only works right for the first one that requires the prerequisite of an order placed.
Ive used a counter to count both buys and sells. For some reason its not producing the second sell . Please help me find out why.
1. How do I get it to also send sells?
2. How do I get it to only send ONE buy when
or ONE sell when
instead of many as it does?
Thanks a ton in advanced.