![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
You are not the only one here.
You are not the only one here too.
I think it has something to do with price being too close to the pending order (or within the FREEZE_LEVEL) entry price.
OMG. It has nothing to do with FREEZE_LEVEL, instead, it is because of other reasons. I guess more homework needs to be taken care of now.
By the way, you still don't cover the basics of how Point works and how you can manipulate it. Do that and you will see what is going on right now.
I don't understand why it is people enjoy spending time just reinforcing what I already know = I am doing something wrong. I have come on here for tips or clues at least...
Anyway, thanks for telling me one tip = it's not the FREEZE_LEVEL...
I've updated the code in my first post.
A = 1.24000
B = 1.24000
Point = 0.00001
( A > B + Point ) is the same as ( 1.24000 > 1.24001) ...
DomGilberto, I sometimes have to wonder if you have difficulty following your own code, especially when you have left it alone for a few days.
If this is the case, imagine how difficult it is for others to follow your code.
I will tell you the process that I went through while looking at your code.
Problem is with Error 130, so I zoom in on OrderSend
Now I see that you use a variable called StopLevel, so where is that assigned a value?
I find it 50 lines back,
Now I'm struggling to work out what you are trying to do here, especially as I do not see where the variable pips is declared and assigned a value. But I guess that it is Point for a 4 digit broker or Point*10 for a 5 digit broker.
Incidently isn't that the same as
So I have worked out that StopLevel is the maximum that the stop loss can be set at for a Buy order.
it's not used in any code in the 50 lines as far as I can see, so why is it 50 lines back?
So we will move it closer to where it is being referenced
Then I look at the next line of code
and I think "Have I misunderstood?
If StopLevel is 5 pips below current price and the calculated BuyStopPrice is 50 pips below current price, you will change BuyStopPrice to 5 pips below?
If StopLevel is 5 pips below current price and the calculated BuyStopPrice is 2 pips below current price, you will not change BuyStopPrice even though it may be too close?
By now, I have a headache and leave it be.
What I am going to do now is print out everything again, and I'll post it up including the specific code that goes along with it. I will also clean up all the crap i've written in the code too. As you've pointed out, it's ridiculous!
Will post shortly
(p.s. just so I know, is my code easier to see now?)
A = 1.24000
B = 1.24000
Point = 0.00001
( A > B + Point ) is the same as ( 1.24000 > 1.24001) ...
You think? I'm looking for people to correct me because they know... Just give me some food for thought at least... Not always asking for just the answer. Your doing neither but having a laugh at my lack of knowledge.
Remember when you were learning programming? Bet you never asked any stupid questions did you...
Anyway, I've figured out WHY I am getting Error 130. It has NOTHING to do with what you're talking about. It was more to do with the logic else-where and the "Stored_BuyPrice". It's a static double and it essentially remembers the previous trades buy price and under a rare situation it will try to place a trade at that price when the price of the market is AT THAT price and the stop is ABOVE (for buy) the entry price.
I will post up once I have figured it out.
Basically, if CheckHistory() returns as True, rather than it progress any further, I want it to wait for a brand new H1 candle? What's a simple way of doing this as I feel like I am getting carried away writing overly complex code for it?
To elaborate further: If CheckHistory returns true and the iTime is within the 1 hour period from the "IsNewCandle()" then I DO NOT want it to progress any further until there IsNewCandle()...
Any help would be hugely appreciative!
Right, I've 100% figured out what the issue was. I am stuck with this "simple" part. Would be hugely appreciative if anyone can give an input?
Basically, if CheckHistory() returns as True, rather than it progress any further, I want it to wait for a brand new H1 candle? What's a simple way of doing this as I feel like I am getting carried away writing overly complex code for it?
To elaborate further: If CheckHistory returns true and the iTime is within the 1 hour period from the "IsNewCandle()" then I DO NOT want it to progress any further until there IsNewCandle()...
Any help would be hugely appreciative!
If you don't want the EA to do anything at all just
(p.s. just so I know, is my code easier to see now?)
Your code is easier to read now that it fits the width of my screen.
The issue is:
As you can see here, it will just go back to IsNewCandle() and just confirm that we are still on the same Bar1Time as before and not actually wait. Basically, if "CheckHistory() == True" then on that specific bar "0" I want NO CODE to run what-so-ever and instead WAIT for "IsNewCandle()" to produce a NEW BAR. On top of this, i then want CheckHistory()==True to be avoided else this code will never progress:
I cannot get this logic down at all... driving me up the wall....