Help with coding
  #1 (permalink)  
Old 10-22-2008, 01:41 PM
Freshman
 
Join Date: May 2008
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
batalhadematos is on a distinguished road
Default Help with coding

Hi there,


I need to make a change on a simple expert advisor that is based on 2 slope direction lines.
This lines, changes to blue when on uptrend and red when on downtrend.


The expert advisor gets a global variable=1 when both uptrend (2 slope=blue) and a global variable=2 when both on downtrend (2 slope=red).
When global variable=1 the ea opens a position BUY, when global variable=2, the ea opens a position SELL.


The problem is that when the profit is reached, it closes the position but if both signals are still there, it opens an additional position. For instance, I am on a position BUY when both slopes are blue with a profit targer=20. When 20 pips are reached, the position is closed BUT IF BOTH SLOPES ARE STILL BLUE, it opens another position...


Can anyone help me with a code that does not open a second position like this? I want to be able to open several positions for the same currency pair, but not when one of them is closes.
I need something that creates a second global variable that after a position is closed it adds a value to it that will be also compared when both slopes gets with the same color, and besides the BLUE / RED conditions it also tests this global variable.


I have been thinking on the following:
- Both slopes becames RED;
- EA opens SELL;
- Second variable gets the NoOpenCondition=TRUE;
- When the position reaches its profit target (or stoploss) it is closed;
- The advisor waits for NoOpenCondition = FALSE and from this moment it waits for a new signal for potential positions.


This NoOpenCondition can be tested by waiting that at least one of the slopes became on the oposite color and when they get the same color again it is a moment for new positions.


Hope you can help me


Best regards


Paulo
Reply With Quote
  #2 (permalink)  
Old 10-23-2008, 02:28 AM
Forex Warrior
 
Join Date: Feb 2007
Posts: 261
Thanks: 9
Thanked 18 Times in 15 Posts
FerruFx is on a distinguished road
Default

Quote:
Originally Posted by batalhadematos View Post
Hi there,


I need to make a change on a simple expert advisor that is based on 2 slope direction lines.
This lines, changes to blue when on uptrend and red when on downtrend.


The expert advisor gets a global variable=1 when both uptrend (2 slope=blue) and a global variable=2 when both on downtrend (2 slope=red).
When global variable=1 the ea opens a position BUY, when global variable=2, the ea opens a position SELL.


The problem is that when the profit is reached, it closes the position but if both signals are still there, it opens an additional position. For instance, I am on a position BUY when both slopes are blue with a profit targer=20. When 20 pips are reached, the position is closed BUT IF BOTH SLOPES ARE STILL BLUE, it opens another position...


Can anyone help me with a code that does not open a second position like this? I want to be able to open several positions for the same currency pair, but not when one of them is closes.
I need something that creates a second global variable that after a position is closed it adds a value to it that will be also compared when both slopes gets with the same color, and besides the BLUE / RED conditions it also tests this global variable.


I have been thinking on the following:
- Both slopes becames RED;
- EA opens SELL;
- Second variable gets the NoOpenCondition=TRUE;
- When the position reaches its profit target (or stoploss) it is closed;
- The advisor waits for NoOpenCondition = FALSE and from this moment it waits for a new signal for potential positions.


This NoOpenCondition can be tested by waiting that at least one of the slopes became on the oposite color and when they get the same color again it is a moment for new positions.


Hope you can help me


Best regards


Paulo
Yes, after your order filled, set a "Trade" variable to false. This variable will be re-set to true when one of the slope change its color.

FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!! More info here
Coding services: Experts Advisors, indicators, alerts, etc ...

NEW: TripleXXX Expert Advisor
developed by Spiritfriends and coded by FerruFx ... more info
Reply With Quote
  #3 (permalink)  
Old 10-23-2008, 02:55 PM
Freshman
 
Join Date: May 2008
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
batalhadematos is on a distinguished road
Default

Quote:
Originally Posted by FerruFx View Post
Yes, after your order filled, set a "Trade" variable to false. This variable will be re-set to true when one of the slope change its color.

FerruFx
Dear FerruFX,

Thank you. I have thought about this solution and works when a specific profit target is reached since I can code this moment. But the problem is when an order is closed on a specific stop loss. I am unable to get a code that gives me the information that the order was closed on stop loss...

Regards

Paulo
Reply With Quote
  #4 (permalink)  
Old 10-24-2008, 11:16 AM
Forex Warrior
 
Join Date: Feb 2007
Posts: 261
Thanks: 9
Thanked 18 Times in 15 Posts
FerruFx is on a distinguished road
Default

Quote:
Originally Posted by batalhadematos View Post
Dear FerruFX,

Thank you. I have thought about this solution and works when a specific profit target is reached since I can code this moment. But the problem is when an order is closed on a specific stop loss. I am unable to get a code that gives me the information that the order was closed on stop loss...

Regards

Paulo
Just check in the history trades if the last one is in profit or loss.

FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!! More info here
Coding services: Experts Advisors, indicators, alerts, etc ...

NEW: TripleXXX Expert Advisor
developed by Spiritfriends and coded by FerruFx ... more info
Reply With Quote
  #5 (permalink)  
Old 10-29-2008, 10:54 PM
therumpledone's Avatar
Senior
 
Join Date: Jun 2007
Posts: 144
Thanks: 0
Thanked 4 Times in 4 Posts
therumpledone is on a distinguished road
Default

Hi FerruFX:

This is the REAL TRO.

I noticed that you think everyone that uses one of my indicators is TRO over on FF and TSD.

Do you know that there are over 1 million people where I live? Do you think I am the ONLY FOREX trader here? Don't you think that some of them might know me and just might use my code, too? Did you know that my code is being used by traders on 6 out of the 7 continents?

Not sure why you seem to have such a problem with me. What have I ever done to you?

I know you don't like my donational indicators because people can get about 200 indicators from me for less than the price of one of yours.

And you probably don't like my free indicators either since they compete with your for sale indicators. Why pay for something when you can get it free?

And I know you don't like to share your source code because then the people using the code wouldn't have to rely on you for modications. Other coders could enhance the code. But you prefer keeping traders dependent on you.

But if you have a problem with me, you don't have to take it out on other people. Our investment group meets at the public library. When we log on, we all have the same IP Address. So I guess that's why you think some people have signed up more than once.

It's too bad that we can't all just get along.
Reply With Quote
  #6 (permalink)  
Old 10-31-2008, 04:50 PM
Forex Warrior
 
Join Date: Feb 2007
Posts: 261
Thanks: 9
Thanked 18 Times in 15 Posts
FerruFx is on a distinguished road
Default

Quote:
Originally Posted by therumpledone View Post
Hi FerruFX:

This is the REAL TRO.

I noticed that you think everyone that uses one of my indicators is TRO over on FF and TSD.

Do you know that there are over 1 million people where I live? Do you think I am the ONLY FOREX trader here? Don't you think that some of them might know me and just might use my code, too? Did you know that my code is being used by traders on 6 out of the 7 continents?

Not sure why you seem to have such a problem with me. What have I ever done to you?

I know you don't like my donational indicators because people can get about 200 indicators from me for less than the price of one of yours.

And you probably don't like my free indicators either since they compete with your for sale indicators. Why pay for something when you can get it free?

And I know you don't like to share your source code because then the people using the code wouldn't have to rely on you for modications. Other coders could enhance the code. But you prefer keeping traders dependent on you.

But if you have a problem with me, you don't have to take it out on other people. Our investment group meets at the public library. When we log on, we all have the same IP Address. So I guess that's why you think some people have signed up more than once.

It's too bad that we can't all just get along.
Not sure why you post this here ???

For your info, I received a PM on FF with the exact same blabla ... coincidence !!!

PS: I don't have nothing against you. You're just little bit paranoid ...
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!! More info here
Coding services: Experts Advisors, indicators, alerts, etc ...

NEW: TripleXXX Expert Advisor
developed by Spiritfriends and coded by FerruFx ... more info
Reply With Quote
  #7 (permalink)  
Old 10-31-2008, 10:08 PM
therumpledone's Avatar
Senior
 
Join Date: Jun 2007
Posts: 144
Thanks: 0
Thanked 4 Times in 4 Posts
therumpledone is on a distinguished road
Default

Quote:
Originally Posted by FerruFx View Post
Not sure why you post this here ???

For your info, I received a PM on FF with the exact same blabla ... coincidence !!!

PS: I don't have nothing against you. You're just little bit paranoid ...
Why here? Because I can't post on those other forums.

Coincidence? NO. One of my friends PMed you after he saw what you wrote about me.

Paranoid? NO. I saw the FALSE ACCUSATIONS you wrote on Forex-TSD.
Reply With Quote
  #8 (permalink)  
Old 11-01-2008, 01:45 AM
Forex Warrior
 
Join Date: Feb 2007
Posts: 261
Thanks: 9
Thanked 18 Times in 15 Posts
FerruFx is on a distinguished road
Default

Quote:
Originally Posted by therumpledone View Post
Why here? Because I can't post on those other forums.

Coincidence? NO. One of my friends PMed you after he saw what you wrote about me.

Paranoid? NO. I saw the FALSE ACCUSATIONS you wrote on Forex-TSD.
Still don't understand why posting here in this "help with coding" thread.

And you may confuse with someone else. I don't remember make accusations about you on TSD forum.

FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!! More info here
Coding services: Experts Advisors, indicators, alerts, etc ...

NEW: TripleXXX Expert Advisor
developed by Spiritfriends and coded by FerruFx ... more info
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help coding a simple EA sundwnr System Coding 1 11-22-2007 10:43 PM
MQL4 Coding robertinno Classified Ads 0 10-01-2007 10:12 PM
Coding Help needed yemupz Trading Systems 0 09-14-2007 03:30 PM
Some coding suggestions 4xdude Tutorials, Tips & Tricks 0 08-27-2007 08:17 AM
Coding an EA ossaossa System Coding 0 04-15-2007 01:25 AM


All times are GMT. The time now is 05:52 PM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now