Need some help w/ logic+syntax

 

Hi there:

Well, I just downloaded the MetaTrader.

Made (half way): a trend following program.

TendUp: if 3 consecutive bars have both -- increasing Highs & increasing Lows.

TrendDown: if 3 consecutive bars have both -- decreasing Highs and decreasing Lows.

Tying to follow the trend and exit by: putting in OrderModify based on the highest High from the last 6 bars (or the lowest Low from the last 6 bars) as long as the ticket is still active in the market.

Then, stay out of the market for 3 bars, to avod sideways action.

Well that is the idea.

However, in practice: Have difficulty to get past the "compile" step.

(The logic might not have been coded right: still working on the if-while and {}...

So attaching my code (such as it is).

If someone could get the program to perform, one could (finally) see if it an OK idea, or not.

Thanks......

Files:
xwe.mq4  6 kb
 
bellco:

Hi there:

Well, I just downloaded the MetaTrader.

Made (half way): a trend following program.

TendUp: if 3 consecutive bars have both -- increasing Highs & increasing Lows.

TrendDown: if 3 consecutive bars have both -- decreasing Highs and decreasing Lows.

Tying to follow the trend and exit by: putting in OrderModify based on the highest High from the last 6 bars (or the lowest Low from the last 6 bars) as long as the ticket is still active in the market.

Then, stay out of the market for 3 bars, to avod sideways action.

Well that is the idea.

However, in practice: Have difficulty to get past the "compile" step.

(The logic might not have been coded right: still working on the if-while and {}...

So attaching my code (such as it is).

If someone could get the program to perform, one could (finally) see if it an OK idea, or not.

Thanks......

There is too many blocks of codes that are questionable as to your intend, to do any alterantions. like the block be low, are these if statments inbedded? can not tell if they are or not other then the indenting tells me they may or should be.

if ((High(c)> High(b)>High(a))

bool bHigh3down=true;

if(Low(c)> Low(b)>Low(a))

bool bLow3down=true;

if (bHigh3down && bLow3down)

bool bTrendDown=true;

your use of the while statement is incorect as well and no indication as to what should be included within that statment as well. a while statement should look like

while( x>=4 ) {

if the while statement is true do these command in side brakets

} end of while statement

You should also pay attention to the scope of your variables dimming and redimming your arrays on each tick is not in almost all cases not needed.

you should take more time reading the limited documentation included with the software and then take some code that some one else has done and make changes to that to that code to find out how each statement response to your changes this will get you a starting handle on the coding.

 

Nope, the if statements referred to are not emmbedded.

But thanks for the advice: the machine might interpret them so.

So, I'll try to work on this.

 

on second thought, the if statements are embedded.

But, the problem (overall is solved.)

Eventually, I'll pay some coder to get my little trading prog right.

Meanwhile, did write to mql.com on how their compiler report could be improved: Have the compiler number the lines of the human code. Then, report errors as: error on line 21, near character 30 (error/error).

And, if I ever become commercial quality, I would (as a trading idea), also se the "circle of winners" idea. [Same as "fantasy football".]

So: pick 10 EA-s that you like.

Go w/ them in real time.

(Since you are diversified, presumably as one loses, an other gains.)

Anyhow, when one prog loses 1/3 of its highest high of its earnings, replace it w/ an other nice prog.

Then, just continue this pattern of money management.