[...] The first two if statements fire, the second two do not. [...]
Your 'loop' makes no sense. As to why the second set of statements don't 'fire', read about the continue operator and make sure u understand what it does.
p.s. Did you read the book or are u just attempting to jump right in? Cause it seems like you haven't...
Gordon, if your going to give me an answer - I request a precise answer. I did "jump right in", and I am reading the book - I'm a hands on learner. I generally trust advice given from people who have gotten a program to execute in lieu of the documentation itself. Documentation is precise most of the time, but never thorough.
How could my loop make more 'sense'?
What would you use instead of continue or return?
PipfX:
[...] How could my loop make more 'sense'?
What would you use instead of continue or return?
It could make more sense if it made at least some sense. Looking at your code I don't understand what u are trying to achieve (even ignoring obvious beginner coding mistakes). The mere fact that u are asking me "what would you use instead of continue or return" tells me that u don't understand either... I suggest u start by defining a flowchart of what u are trying to achieve and only later try to convert it into code.
res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,Bid+0.001,0,"",MAGICMA,0,Purple);//No worky either
On a 5 digit broker you must adjust TP, SL, and slippage.//++++ These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits == 5 || Digits == 3){ // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
On an ECN broker you must send the order first then modify the TP/SL.
If the send fails print out GetLastError() so you know why
res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Ask,3,Ask-0.001,0,"",MAGICMA,0,Orange);
On a sell you open at the Bid, the SL is relative to the Ask.for(int i=1;i>= 0;i--)
Are you really trying to open Two orders?
Gordon - I have one I shouldn't of just
WHRoeder - OMG Thanks, I totally didn't think about GetLastError(), I was just using alert testing on each function to figure out where it wasn't going through.
Turns out I had the Select thread tied up in another loop, I fixed it last night and things are going dandy. Thanks for your time you guys!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi!
I am using the following loop to execute trades. The first two if statements fire, the second two do not. I was wondering if anyone had suggestions on how to get this working