Download MetaTrader 5

Code for "Do not place another order in same hour when you got a loss order already"

To add comments, please log in or register
Use MQL5 Cloud Network. Test robots at a super speed!
Jhay82
41
Jhay82 2014.03.06 19:50 

Hello,

Curious if anyone knows how to do this.

I mean, when my sell or buy order closed at 8:17pm with a loss, I dont want to place an order until 8:59pm or something like that.

I'd appreciate if anyone knows code for this.

My regards.

qjol
3243
qjol 2014.03.06 19:52  
Jhay82:


Curious if anyone knows how to do this.



of cource
whroeder1
14489
whroeder1 2014.03.06 20:12  
It's not hard.
Keith Watford
Moderator
9619
Keith Watford 2014.03.06 20:25  

You can use iTime, OrderCloseTime and OrderProfit

datetime hour_start = iTime(Symbol(),PERIOD_H1,0);
//Loop through OrdersHistory
if(OrderCloseTime() >= hour_start && OrderProfit < 0)
//Do not trade
Jhay82
41
Jhay82 2014.03.07 09:00  

thanks, I am at very first stage on coding, currently tryin to add this,

so far

it isnt stop still after first loss keep doin trades in same minute

checking to see why

Daniel Petrovai
440
Daniel Petrovai 2014.03.07 22:19  
Jhay82:

thanks, I am at very first stage on coding, currently tryin to add this,

so far

it isnt stop still after first loss keep doin trades in same minute

checking to see why


It would be so much easier if you could post your code.

James Hodges
3168
James Hodges 2014.03.07 22:45  

Yea... coming here is like going to the mechanic or veterinarian and leaving your car or pet at home... It's a lot easier to diagnose your problem when we can actuallly inspect the patient....

I really need to make a little tutorial video about using this editor... But I'm not sure I understand it all myself.... any way....
The proper way to put your code on here is to go into your code and select it with Ctrl A and then Ctrl C to copy it into your clip board... then come over here to the forum and Press that button in the menu that says SRC which is for source code.... then after the box comes up ... click inside it and press Ctrl V to paste your code from your computer's clipboard memory into the box.... then press the insert button .. tada!

HOWEVER,
if you have code that has been decompiled from someone's ex4/5 file you do not want to post it here. It may get you yelled at a little bit. Of course, I realize that you may not know how to tell what you have been sold or given. But chances are if all the variables seem to have weird letter/number combination names like this one.... you don't want to post it on here...

Having said that.. sometimes people do not know that what they have posted is improper.. all we ask is that if you are told that it is something that needs removed from the forum.. remove it.. ...

Jhay82
41
Jhay82 2014.03.07 23:05  
its firebirds EA, and I am tryin to add some codes in it. If its not forbidden I am gonna post the code.
Daniel Petrovai
440
Daniel Petrovai 2014.03.08 23:12  
Jimdandy:

Yea... coming here is like going to the mechanic or veterinarian and leaving your car or pet at home... It's a lot easier to diagnose your problem when we can actuallly inspect the patient....

........

.......

Having said that.. sometimes people do not know that what they have posted is improper.. all we ask is that if you are told that it is something that needs removed from the forum.. remove it.. ...


Hi Jimdandy,

Do you mind if I ask you to please explain a bit more the stolen code theory ? I had a look at the post you suggested and I really don't get it how the "experts" can determine if the code is stolen just by looking at the variables names.

I understand the "chances are" possibility but that is just that, a possibility. I used quite a lot in my codes d_variable for local double and gd_double for global doubles and I found it useful and helped me stay away of possible loss due to conversion errors.

So, is it just the 64 in l_price_64 that points to stolen code ? I mean, if I wanted to confuse the possible decompilers, would I still use d_Spread or s_TradeComment to just make it clearer or maybe I would replace all variables with

confusing names like " awe_23qw_3 " for, let's say, spread ? Just to detour or at least make it harder for curious eyes to follow my code if they decompile it ? After all, I still have the original code if I want to add, change or improve on.

I guess some clarifications on this issue may be required and helpful for most of us.

Expecting everyone to be an expert and spot out decompiled code just like that, doesn't really make any sense. Especially in this day and age when one can go on ebay and get a tone of EAs for 10 bucks.

And if "No self-respecting programmer would name a variable ' l_price_72 ' "is true, why all the fuss about it ? Just to defend a " non self-respecting programmer " who probably couldn't care less?

Alain Verleyen
Moderator
30728
Alain Verleyen 2014.03.09 00:02  
Jhay82:
its firebirds EA, and I am tryin to add some codes in it. If its not forbidden I am gonna post the code.
Please post your code if you want help.
Ian Venner
2584
Ian Venner 2014.03.09 02:00  
thrdel:


Hi Jimdandy,

Do you mind if I ask you to please explain a bit more the stolen code theory ? I had a look at the post you suggested and I really don't get it how the "experts" can determine if the code is stolen just by looking at the variables names.

I understand the "chances are" possibility but that is just that, a possibility. I used quite a lot in my codes d_variable for local double and gd_double for global doubles and I found it useful and helped me stay away of possible loss due to conversion errors.

So, is it just the 64 in l_price_64 that points to stolen code ? I mean, if I wanted to confuse the possible decompilers, would I still use d_Spread or s_TradeComment to just make it clearer or maybe I would replace all variables with

confusing names like " awe_23qw_3 " for, let's say, spread ? Just to detour or at least make it harder for curious eyes to follow my code if they decompile it ? After all, I still have the original code if I want to add, change or improve on.

I guess some clarifications on this issue may be required and helpful for most of us.

Expecting everyone to be an expert and spot out decompiled code just like that, doesn't really make any sense. Especially in this day and age when one can go on ebay and get a tone of EAs for 10 bucks.

And if "No self-respecting programmer would name a variable ' l_price_72 ' "is true, why all the fuss about it ? Just to defend a " non self-respecting programmer " who probably couldn't care less?


When code is decompiled the decompiler recreates the source code in such a way that an experienced programmer can immediately recognise it as decompiled code. The rules of this forum pretty much amount to this: Decompiled code is considered stolen. As it is very difficult to prove it is not stolen the rule of thumb is, avoid altercations with the moderators by only posting questions about original source code.

If you post some decompiled code because you didnt realise it was decompiled, the moderators will probably delete it from your post and warn you about it.

If you deliberately obscured the variables yourself there would be little point in posting it, who is going to spend their time trying to unravel your deliberately obscured code to help you with it ? Like you said, you would still have the original code so just post it instead.

There is no point in making argument about the rules based on scenarios that try to prove they are wrong or unacceptable. The forum moderators are still going to enforce their rules.

12
To add comments, please log in or register