Need advise on this code

fxcba
Trader
Posts: 46
Joined: Wed Aug 21, 2013 10:10 pm

Need advise on this code

Post by fxcba »

Ok, here is
You do not have the required permissions to view the files attached to this post.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Need advise on this code

Post by milanese »

here you go, now the magicnumber calculation code should work too..
UniversalMACrossEA_6xx.mq4
Cheers :)

Tommaso
You do not have the required permissions to view the files attached to this post.
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
fxcba
Trader
Posts: 46
Joined: Wed Aug 21, 2013 10:10 pm

Need advise on this code

Post by fxcba »

Hey Tommaso, so all problem was the capital "m"? (I need to pay more atention :oops: )
Thank you
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Need advise on this code

Post by milanese »

fxcba » Sat Jul 26, 2014 4:02 pm wrote:Hey Tommaso, so all problem was the capital "m"? (I need to pay more atention :oops: )
Thank you
there were some minor thingies, like missing brackets, redefining a global variable and line 874 was incomplete..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
fxcba
Trader
Posts: 46
Joined: Wed Aug 21, 2013 10:10 pm

Need advise on this code

Post by fxcba »

milanese » Sat Jul 26, 2014 1:18 pm wrote: there were some minor thingies, like missing brackets, redefining a global variable and line 874 was incomplete..

Cheers :)

Tommaso
yes, that was me doing trial and error untill I commented all
but I see that "MagicNumber" now is "magic_number", and "int isymbol=" is "int isymbol =0", so I think there were the main issue.
thank you again
cheers
fxcba
Trader
Posts: 46
Joined: Wed Aug 21, 2013 10:10 pm

Need advise on this code

Post by fxcba »

Hello, It's me again :) . Today I want to ask a couple of questions
I'm working on "iHigh" and "iLow" function and how it works, this line:
HiPrice = MathMax(HiPrice,iHigh(NULL,PERIOD_CURRENT,shift+1));
makes the EA jumps in trade when price equals previous high, so, first question, what should be written to add a buffer in order to wait price exceed some pips the high?
second question: there is also a several types of periods to choose instead "PERIOD_CURRENT", like "PERIOD_H2", in this case I asume Empty4 will read the high of the last 2 hours, Am I right?, taking this in acount my question is standard Empty4 charts starts at 0 h and ends 23:59 how to make script starts at 0 h reading 12 blocks of 2 hs, stop at 23hs and start again?
Regards and thank you in advance
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Need advise on this code

Post by SteveHopwood »

Hello, It's me again :) . Today I want to ask a couple of questions
I'm working on "iHigh" and "iLow" function and how it works, this line:
HiPrice = MathMax(HiPrice,iHigh(NULL,PERIOD_CURRENT,shift+1));
makes the EA jumps in trade when price equals previous high, so, first question, what should be written to add a buffer in order to wait price exceed some pips the high?
Declare a buffer that you can show as an extern or hard code to your chosen value:

Code: Select all

double BufferPips = 10;
HiPrice = MathMax(HiPrice,iHigh(NULL,PERIOD_CURRENT,shift+1));
HiPrice+= (BufferPips * Point);
You would be better off going into any of my ea's and borrowing Paul's pip factor code, so the code becomes

Code: Select all

HiPrice+= (BufferPips / factor);
but you might not be ready for that yet.
second question: there is also a several types of periods to choose instead "PERIOD_CURRENT", like "PERIOD_H2", in this case I asume Empty4 will read the high of the last 2 hours, Am I right?, taking this in acount my question is standard Empty4 charts starts at 0 h and ends 23:59 how to make script starts at 0 h reading 12 blocks of 2 hs, stop at 23hs and start again?
Regards and thank you in advance
Over to someone else for that one.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
fxcba
Trader
Posts: 46
Joined: Wed Aug 21, 2013 10:10 pm

Need advise on this code

Post by fxcba »

Hello Steve, thank you for your answer.
Regarding second question I've be reading some ea's code and I think this can be done with a start day and hour I'll keep searching
cheers
fxcba
Trader
Posts: 46
Joined: Wed Aug 21, 2013 10:10 pm

Need advise on this code

Post by fxcba »

Thank you again, it's working fine :clap:, next week I'll do some forward test to see how Empty4 counts the hours starting on monday at 0 hs.
Where can I find some info about closing the trade on opposite signal?, so far this ea trades one direction untill takes profit or is stopped.
Sorry for ask this way but I only devote a couple of hours a week to coding, so I'm trying to save some research time.
Thank you
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Need advise on this code

Post by SteveHopwood »

fxcba » Fri Sep 12, 2014 3:15 pm wrote: Where can I find some info about closing the trade on opposite signal?, so far this ea trades one direction untill takes profit or is stopped.
Download one of my shells from http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79.

Go to void CountOpenTrades() and see how the function builds up a picture of trades belonging to the ea. Find this line of code:
TradeWasClosed=LookForTradeClosure(OrderTicket()); to see how the closure function is called and what to do with the loop in the event of a trade being closed.

Then look at bool LookForTradeClosure(int ticket) and see how you can set CloseThisTrade to true if your system has generated an opposite direction signal.

I am not saying this is the only way, or even the best way to do this. I can say that it has worked time and time and time again for me.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
Post Reply

Return to “Coders Hangout”