Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


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 (2) Thread Tools Display Modes
  #211 (permalink)  
Old 08-01-2006, 06:18 AM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
Quote:
Originally Posted by billworld2
Thanks, but, I'm stuck specifically on how to code the script. If you have time to provide a short example, that would be most appreciated.

Thanks again.

Bill
first declare global variable (global for the script) int objectCount;
then at the end of the ea process all objects (u can for eg search them by name)

for(int i=0;i>=ObjectsTotal(OBJ_ARROW) ;i++)
{
//then if object label dont exists draw it, lets say that we will take the
//name of existing arrow and add L label to it, to identify it

if(ObjectFind(ObjectName(i)+"L")== -1)
{
ObjectCreate(ObjectName(i)+"L",OBJ_ARROW,0,ObjectG et(ObjectName(i), OBJPROP_TIME1),ObjectGet(ObjectName(i),(OBJPROP_PR ICE1+3*Point)));
// and that is it
}
}


That is just an example, I havent got time to check it for possible bugs but this should work, and u know now the right way.
__________________
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
  #212 (permalink)  
Old 08-01-2006, 03:25 PM
Member
 
Join Date: Dec 2005
Posts: 31
billworld2 is on a distinguished road
Okay. Got it. I actually needed to use StringFind(). Thanks for the pointers!

#property show_inputs

extern string stringname="blah";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----

for(int i=0;i<ObjectsTotal();i++)

if(StringFind(ObjectName(i),stringname,0)>0)
{
ObjectDelete(ObjectName(i));
}


Quote:
Originally Posted by Kalenzo
Ok , try this:



for(int i=0;i<ObjectsTotal();i++)
{
string name = ObjectName(i);

if(StringSubstr( name, 0, 3)==206)
{
ObjectDelete(ObjectName(i));

}
}

If the first 3 leters of the name of the object will be 206 then the object will be deleted
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #213 (permalink)  
Old 08-01-2006, 04:26 PM
Member
 
Join Date: Dec 2005
Posts: 31
billworld2 is on a distinguished road
Thanks, but, this doesn't work. First, I changed "i>=ObjectsTotal" to "i<=ObjectsTotal" (typo). Then, I noticed that you're creating another arrow object where we want to create a new text object which includes the name of the arrow object. Anyway, the code below is creating a bunch of arrows (around 50) all overlapping on the same coordinates.

Still lost on this one. If you have a chance to take another look, that would be much appreciated. To be clear, I'm looking to create one new text object which gets positioned below each existing arrow object where the text description of the text object is equal to the name of the arrow object.

Bill

Quote:
Originally Posted by Kalenzo
first declare global variable (global for the script) int objectCount;
then at the end of the ea process all objects (u can for eg search them by name)

for(int i=0;i>=ObjectsTotal(OBJ_ARROW) ;i++)
{
//then if object label dont exists draw it, lets say that we will take the
//name of existing arrow and add L label to it, to identify it

if(ObjectFind(ObjectName(i)+"L")== -1)
{
ObjectCreate(ObjectName(i)+"L",OBJ_ARROW,0,ObjectG et(ObjectName(i), OBJPROP_TIME1),ObjectGet(ObjectName(i),(OBJPROP_PR ICE1+3*Point)));
// and that is it
}
}


That is just an example, I havent got time to check it for possible bugs but this should work, and u know now the right way.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #214 (permalink)  
Old 08-01-2006, 05:11 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
Quote:
Originally Posted by billworld2
Thanks, but, this doesn't work. First, I changed "i>=ObjectsTotal" to "i<=ObjectsTotal" (typo). Then, I noticed that you're creating another arrow object where we want to create a new text object which includes the name of the arrow object. Anyway, the code below is creating a bunch of arrows (around 50) all overlapping on the same coordinates.

Still lost on this one. If you have a chance to take another look, that would be much appreciated. To be clear, I'm looking to create one new text object which gets positioned below each existing arrow object where the text description of the text object is equal to the name of the arrow object.

Bill
I wanted just to show u the idea. I think it is so easy that when u will read all the code and understand the idea, u will make a good code.
__________________
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
  #215 (permalink)  
Old 08-01-2006, 05:30 PM
Member
 
Join Date: Dec 2005
Posts: 31
billworld2 is on a distinguished road
But the idea which is "so easy" doesn't work. I guess if it's so easy, why not just show a correct answer rather than post something which doesn't work and claim it's "so easy"? Everything is easy once one understands how to do it.


Quote:
Originally Posted by Kalenzo
I wanted just to show u the idea. I think it is so easy that when u will read all the code and understand the idea, u will make a good code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #216 (permalink)  
Old 08-01-2006, 05:41 PM
Member
 
Join Date: Dec 2005
Posts: 31
billworld2 is on a distinguished road
Still looking for assistance here. Maybe this is really elementary, but, I'm not finding any good documentation to clear this up.

I understand how to count bars right to left (present to past) in ascending order and how to count bars left to right in descending order. What I don't get is how to count bars left to right in ASCENDING order. It's been mentioned to take a look at iBarsShift, but iBarsShift references the count from right to left. There's something else missing which I'm not getting.

I simply want to count bars from left to right (past to present) starting the beginning of each month.

Forgive me if this is quite elementary. And, thanks for any help.

Bill

Quote:
Originally Posted by billworld2
Bar counting always occurs right to left (present to past) in MQL correct?

How do I achieve past to present bar counting?

For a simple example, how would I go about numbering each bar in a given month with 1 representing the first bar of the month and subsequent bars incrementing up?

Thanks for any assistance.

Bill (still caught in a loop)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #217 (permalink)  
Old 08-04-2006, 03:36 PM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
Arrow Hello again, from the depths of darkness

I haven't been on much lately because ever since I learned about interbankfx's "days off" on july 4'rth, I've been working on a safety detector, to safely exit trades, and not open new ones before the ea's stops executing (the next best thing to finding a new broker, I hope ). Just don't expect a full ea, (it's an ea setup guide in an ea file).

Creating has pushed me much futher in coding experience than i expected (or wished for ), and now i have one question that research has failed to answer. the troublemaker in question seems to me to have a fairly simple answer, but i've had no luck in finding it, so i'm not very accurate in saying it is.

Is there any way to have a function look at the current trade and see if it's profitable?
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER,
"Genius is nothing but a greater aptitude for patience." –Benjamin Franklin

____________________________________

Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!!

http://sufx.core.t3-ism.net/ExpertAdvisorBuilder

Last edited by Eaglehawk; 10-21-2006 at 06:37 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #218 (permalink)  
Old 08-04-2006, 03:41 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
Quote:
Originally Posted by Eaglehawk
I haven't been on much lately because ever since I learned about interbankfx's "days off" on july 4'rth, I've been working on a safety detector, to safely exit trades, and not open new ones before the ea's stops executing (the next best thing to finding a new broker, I hope ). Just don't expect a full ea, (it's an ea setup guide in an ea file).

Creating has pushed me much futher in coding experience than i expected (or wished for ), and now i have one question that research has failed to answer. the troublemaker in question seems to me to have a fairly simple answer, but i've had no luck in finding it, so i'm not very accurate in saying it is.

Is there any way to have a function look at the current trade and see if it's profitable?
Step by step:
1) Select the current order
2) Read the order open price
3a) if order is LONG then ASK-OrderOpenPrice()
3b) if order is SHORT then OrderOpenPrice() - BID
4) If the value of previous operation is > 0 then order is proftable.

Thats all
__________________
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
  #219 (permalink)  
Old 08-04-2006, 03:47 PM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
that's it?

Wow! It works. Thanks! (I can't believe it was so simple )
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER,
"Genius is nothing but a greater aptitude for patience." –Benjamin Franklin

____________________________________

Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!!

http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #220 (permalink)  
Old 08-04-2006, 03:50 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
Quote:
Originally Posted by Eaglehawk
Wow! It works. Thanks! (I can't believe it was so simple )
Sometimes even so simple things, looks so hard to handle
__________________
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

Tags
histogram, forex, ZUP_v1.mq4

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 Off
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 10:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 12:46 PM


All times are GMT. The time now is 06:15 AM.



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