Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-06-2006, 06:01 AM
Junior Member
 
Join Date: Apr 2006
Posts: 7
carpe193deim is on a distinguished road
How to get EA to remember value of variable from one tick to next?

Hi I'm trying to get an expert adviser to remember the highest ask or bid value as an order goes along with some code like this:

if(Bid>HPriceB && OrderType()==OP_BUY && OrderMagicNumber()==1)
{
HPriceB=Bid;
}

But it seems every time it reruns the adviser with each tick , it forgets the value of HPriceB and resets it to zero. What do I do to get it to remember the current value?

Do I need to define or declare it in some special way besides just extern double or int?

Thanks so much for the help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-06-2006, 07:47 AM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 693
Kalenzo is on a distinguished road
Quote:
Originally Posted by carpe193deim
(...) Do I need to define or declare it in some special way besides just extern double or int?
Yes. HPriceB needs to be declared before init deinit and start function, just like extern variables but without extern word.
Eg.
Code:
#property some_property

double HPriceB;

int init(){return(0);}
int deinit(){return(0);}
int start(){return(0);}
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dont remember but jyrik Expert Advisors - Metatrader 4 0 11-03-2006 05:03 AM
What's the best way to check if the tick is the first tick of the new bar? blooms Metatrader 4 2 10-31-2006 06:10 AM
Problem using Variables Tick-by-Tick unltdsoul Metatrader 4 2 07-04-2006 03:36 AM


All times are GMT. The time now is 02:27 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.