Help - 1 trade per bar

Back to topics list To post a new topic, please log in or register
avatar
1
alexbau 2016.05.01 23:04
 

Friends, hello.

 

I wish someone could help me.

I create the expert advisor in the file below.

But I would like the expert advisor to execute only one order per bar.

Can anyone help me with the code and where in the expert advisor I put these codes? 

Attached files:
  forexforce31.txt  (5.41 KB)
avatar
119
Doerk 2016.05.02 07:42 #
 

... 

static datetime tlastbar=0;

datetime tnewbar=iTime(NULL,PERIOD_CURRENT,0);

bool isnewbar=tnewbar!=tlastbar;

tlastbar=tnewbar; 

if (!newbar)

   return;

avatar
1200
FMIC 2016.05.02 09:43 #
 
@Doerk: Your heart is obviously in the right place, but unfortunately I don't think the OP is going to be able to use your code because he is using a Code Generator. He does not seem to know how to code in MQL4 at all, so I guess he will just have to follow one of those 3 options that WHRoeder usually lists (ie. To either Learn It, Search for It or Hire someone to Code it for him).
avatar
119
Doerk 2016.05.02 16:10 #
 
FMIC:
@Doerk: Your heart is obviously in the right place, but unfortunately I don't think the OP is going to be able to use your code because he is using a Code Generator. He does not seem to know how to code in MQL4 at all, so I guess he will just have to follow one of those 3 options that WHRoeder usually lists (ie. To either Learn It, Search for It or Hire someone to Code it for him).
Didnt recognize the code builder immediately. It was just copy and paste during a cup of coffee during a break on the terrace :) But I agree totally with the opinion about code generators. 
avatar
12985
WHRoeder 2016.05.02 18:49 #
 
  • We hate EA builder
  • You couldn't be bothered to learn mql4, therefor there is no common language for us to communicate.
  • There are only two choices: learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds lines of code.
  • EA builder makes bad code counting up while closing multiple orders.
  • EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time
  • EA builder makes bad code Not adjusting for 4/5 digit brokers
  • EA builder makes bad code not adjusting for ECN brokers.
  • EA builder makes bad code not checking return codes.
  • EATree uses objects on chart to save values - not persistent storage (files or GV+Flush.) No recovery (crash/reboot.)
Back to topics list  

To add comments, please log in or register