stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

TMA_CG: EA to buy at support & sell at resistance
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3372
Page 7 of 30
Author:  dudest [ Mon Jan 13, 2014 1:26 pm ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

Based on recent feedback, I am uploading "TMACG_Gold_M15_STACKING_C" to Post #1

a) Symbol and Magic Number checks added to every fuction
--> Symbol needs to be XAU* [ e.g, XAUUSD, XAUUSDm, etc; so long as XAU is in the name ]
--> You can now configure Magic Numbers for normal (default: 1000) and stack trades (default: 3000).
--> The functions will only operate on the configured magic numbers

Code: Select all

extern int MagicNumber_Normal = 1000;
extern int MagicNumber_Stack = 3000;
b) Avoid opening stack trade when too near to TP
--> False by default ( for people like me )
--> Default minimum distance to TP to allow for stack trade: 30pips ( only taken to account if AvoidStackingNearTP = true )

Code: Select all

extern bool AvoidStackingNearTP = false;
extern double MinimumStackTPPips = 30.0;
===

For those not needing above two features, you can continue using "TMACG_Gold_M15_STACKING_B" if you don't want to change the one running on Empty4 right now ( no change in core functionality ).

Cheers
Author:  MrLong [ Mon Jan 13, 2014 1:31 pm ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

Hi dudest,

&& should be ||

Code should be : if ( (OrderMagicNumber() != 1000) || (OrderMagicNumber() != 3000) ) continue;

Andy
Author:  bazze [ Mon Jan 13, 2014 3:01 pm ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

dudest » Mon Jan 13, 2014 1:16 pm wrote:
bazze » Mon Jan 13, 2014 1:35 pm wrote:Three trades closed so far...-$99,+$124.16 and +$18.56.That gives a total of +$36.93 on my $5000 demoacc.Changed the risk from 3 to 2,rest default...Looking good so far :clap:
Edit: New trade open,at the moment up $16...
That's great bazze :)

So if I calculate correctly:

# Your lotsize = (0.02 * 5000 = $100) / (30pips SL) = $3.3 per pip ==> 0.33 lots

Trade 1: -$99 ==> 30 pips SL
Trade 2: +$124.16 ==> 37.62 pips TP
Trade 3: +$18.56 ==> 5.62 pips TP

My trades today so far:
Trade 1: -54.1 pips ( got slipped crazy :/ that's almost an extra trade worth of SL! )
Trade 2: +38.0 pips
Trade 3: +4.8 pips
Trade 4: BUY trade waiting for NY to open before deciding where to go :)

Cheers!
Yeah,it seems like this have a potensial :smile: At the moment the EA have four trades open,so far approx.+$150.So we'll see how the EA handles this :?:
Author:  dudest [ Mon Jan 13, 2014 4:43 pm ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

MrLong » Mon Jan 13, 2014 4:31 pm wrote:Hi dudest,

&& should be ||

Code should be : if ( (OrderMagicNumber() != 1000) || (OrderMagicNumber() != 3000) ) continue;

Andy
Hi Andy!

Thanks for pointing this out.

At first, I thought it should be || (OR), but then it occurred to me that with an OR, you only need one of the tests to evaluate to true for the whole function to be true.

So in our case: if ( (OrderMagicNumber() != 1000) || (OrderMagicNumber() != 3000) ) continue;
--> If the magic number is not 1000 (say it's 3000): the function will eval to true based on the first condition, and 'continue' will apply (without testing the 2nd condition), wrongly skipping a valid order.

So I put: if ( (OrderMagicNumber() != 1000) && (OrderMagicNumber() != 3000) ) continue;
--> So that BOTH conditions have to evaluate to true for the particular selected order to be skipped (continue).
--> So if a magic number is 3000: second condition fails, function evaluates to false -> order is (rightly) processed
--> If a magic number is 100: both conditions eval to true, and order is (rightly) skipped

I think the || would apply if I was testing the conditions in order to immediately execute the code for them (as opposed to testing the conditions to remove the unwanted orders).

==

Please correct me if I'm missing something.... :| I could be wrong.

Cheers
Author:  MrLong [ Mon Jan 13, 2014 5:04 pm ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

Hi,

&& would be checking if the magicnumber is both these value.

|| would mean if the value is not either of these numbers.

So you would be saying if the magic numbers are not either 1000 or 3000 continue, they don't belong to my EA.

Edit:

Try:
if (OrderMagicNumber() != 1000) continue;
if (OrderMagicNumber() != 3000) continue;

Edit:
I've just run a test and I'm wrong, your code works.
Sorry :oops:



Andy
Author:  dudest [ Mon Jan 13, 2014 6:30 pm ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

dudest » Mon Jan 13, 2014 4:26 pm wrote:Based on recent feedback, I am uploading "TMACG_Gold_M15_STACKING_C" to Post #1

a) Symbol and Magic Number checks added to every fuction
--> Symbol needs to be XAU* [ e.g, XAUUSD, XAUUSDm, etc; so long as XAU is in the name ]
--> You can now configure Magic Numbers for normal (default: 1000) and stack trades (default: 3000).
--> The functions will only operate on the configured magic numbers

Code: Select all

extern int MagicNumber_Normal = 1000;
extern int MagicNumber_Stack = 3000;
b) Avoid opening stack trade when too near to TP
--> False by default ( for people like me )
--> Default minimum distance to TP to allow for stack trade: 30pips ( only taken to account if AvoidStackingNearTP = true )

Code: Select all

extern bool AvoidStackingNearTP = false;
extern double MinimumStackTPPips = 30.0;
===

For those not needing above two features, you can continue using "TMACG_Gold_M15_STACKING_B" if you don't want to change the one running on Empty4 right now ( no change in core functionality ).

Cheers
Ver "TMACG_Gold_M15_STACKING_C" uploaded

Also contains code to check (when placed on a chart) whether trades belonging to it are already running (to avoid placement of multiple trades of the same type (esp at the same area) )

Also contains LibCSS code as extracted from LibCSS.mqh by SpiderX (thanks Spidey!)

Cheers
Author:  dudest [ Mon Jan 13, 2014 6:34 pm ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

MrLong » Mon Jan 13, 2014 8:04 pm wrote:Hi,

&& would be checking if the magicnumber is both these value.

|| would mean if the value is not either of these numbers.

So you would be saying if the magic numbers are not either 1000 or 3000 continue, they don't belong to my EA.

Edit:

Try:
if (OrderMagicNumber() != 1000) continue;
if (OrderMagicNumber() != 3000) continue;

Edit:
I've just run a test and I'm wrong, your code works.
Sorry :oops:



Andy
No Andy, I'm grateful that you ran checks, and we are sure that the code works!

Thanks Andy :)

Cheers
Author:  cad0811 [ Tue Jan 14, 2014 5:07 am ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

dudest » Tue Jan 14, 2014 2:34 am wrote:
MrLong » Mon Jan 13, 2014 8:04 pm wrote:Hi,

&& would be checking if the magicnumber is both these value.

|| would mean if the value is not either of these numbers.

So you would be saying if the magic numbers are not either 1000 or 3000 continue, they don't belong to my EA.

Edit:

Try:
if (OrderMagicNumber() != 1000) continue;
if (OrderMagicNumber() != 3000) continue;

Edit:
I've just run a test and I'm wrong, your code works.
Sorry :oops:



Andy
No Andy, I'm grateful that you ran checks, and we are sure that the code works!

Thanks Andy :)

Cheers
Sorry to disturb you!I test the C version, if currencies have the suffix, still doesn't work, thank you!When no suffix is working.

Supplement: I use roboforex two accounts to test, a suffix, without a suffix.

Thank you again for your work!
Author:  varso [ Tue Jan 14, 2014 6:42 am ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

cad0811 » Tue Jan 14, 2014 6:07 am wrote:
dudest » Tue Jan 14, 2014 2:34 am wrote:
MrLong » Mon Jan 13, 2014 8:04 pm wrote:Hi,

&& would be checking if the magicnumber is both these value.

|| would mean if the value is not either of these numbers.

So you would be saying if the magic numbers are not either 1000 or 3000 continue, they don't belong to my EA.

Edit:

Try:
if (OrderMagicNumber() != 1000) continue;
if (OrderMagicNumber() != 3000) continue;

Edit:
I've just run a test and I'm wrong, your code works.
Sorry :oops:



Andy
No Andy, I'm grateful that you ran checks, and we are sure that the code works!

Thanks Andy :)

Cheers
Sorry to disturb you!I test the C version, if currencies have the suffix, still doesn't work, thank you!When no suffix is working.

Supplement: I use roboforex two accounts to test, a suffix, without a suffix.

Thank you again for your work!
I confirm this problem. I have also roboforex and the name for gold is XAUUSD.m with "m" like suffix.
And many others brokers have suffix.
Please if you can repair this problem it will be very grateful.
Thank you
Author:  dudest [ Tue Jan 14, 2014 7:19 am ]
Post subject:  Re: TMA_CG: EA to buy at support & sell at resistance

cad0811 » Tue Jan 14, 2014 8:07 am wrote:
Sorry to disturb you!I test the C version, if currencies have the suffix, still doesn't work, thank you!When no suffix is working.

Supplement: I use roboforex two accounts to test, a suffix, without a suffix.

Thank you again for your work!
varso » Tue Jan 14, 2014 9:42 am wrote:
I confirm this problem. I have also roboforex and the name for gold is XAUUSD.m with "m" like suffix.
And many others brokers have suffix.
Please if you can repair this problem it will be very grateful.
Thank you
Hi guys,

Thanks for your feedback!

Could either of you please post up a VERY CLEAR chart of your XAUUSD.m also showing the F9 (quotes) window?

( i.e, open up XAUUSD.m, remove indis & whatnot, change the scheme to something clear (e.g black over white), press F9, then take screenshot and upload )

I haven't hard-coded names anywhere, so I'm wondering whether your Digits are off? (affects the Pip Factor)

Also check your Journal and Experts tabs for ANY errors and paste those too if you find them

Cheers
All times are UTC Page 7 of 30