EA Buy / Sell Code Problem

 

Can anyone offer some help in correcting this buy / sell code ? Any help is much appreciated.

<SNIP>

 
resirca52009:

Can anyone offer some help in correcting this buy / sell code ? Any help is much appreciated.

<SNIP>


Please edit your post . . . 


Please use this to post code . . . it makes it easier to read.

 
You haven't said what the problem is other than you have a problem,  and you haven't shown your code for Buy(), Sell(), CloseLong() and CloseShort()
 
  1. Nor have you posted a link where we would find your "Center Of Gravity Oscillator" so we can't even verify your iCustom.


  2. For large amounts of code, attach it
 
RaptorUK:
You haven't said what the problem is other than you have a problem,  and you haven't shown your code for Buy(), Sell(), CloseLong() and CloseShort()

Raptor,

Sorry about that ...I wasn't aware it couldn't been seen. I am not very savvy with the forums. I will reedit the post.

 
The redited code is attached :
The problem seems to be that it is either all buy or all sell and I consequently can not test in the strategy tester. Says my results have been discarded as insignificant. 
Probably a silly mistake, I just can't see it right now. Any help would be much appreciated.
Files:
 
resirca52009:

The problem seems to be that it is either all buy or all sell and I consequently can not test in the strategy tester. Says my results have been discarded as insignificant. 
Probably a silly mistake, I just can't see it right now. Any help would be much appreciated.
Don't try and Optimize . .  first test on a single run and make sure your code is doing what you think it should be doing.  You still haven't included the functions I asked about . . .  Buy()  is not a mql4 Function . . .
 

Raptor,


Pardon my ignorance but is not the code I put in the text file the buy and sell code that defines my trading conditions ? By the way I will take your advice and run a single test to verify its functionality. Thanks for your input.

 
resirca52009:

Raptor,

Pardon my ignorance but is not the code I put in the text file the buy and sell code that defines my trading conditions ? By the way I will take your advice and run a single test to verify its functionality. Thanks for your input.

It probably is . . .  but it is not the code that places the Orders.  If your print output to the log agrees with the trades that are being taken then the issue may not be with the code that actually places the orders . . .
 
RaptorUK:
It probably is . . .  but it is not the code that places the Orders.  If your print output to the log agrees with the trades that are being taken then the issue may not be with the code that actually places the orders . . .


Raptor,

Ok, I'll look into that. I did run a single test. I will try attach a copy in a minute. It appears to function OK....I mean it operates, albeit not very well considering this is my first time coding / programming my discretionary trading system.

 

1. Can you attach "Center Of Gravity Oscillator" CI ?

2. Assign your iCustom to a variable, it will make your code more readable. 

Reason: