Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - 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-28-2006, 08:47 PM
Kurka Fund's Avatar
Senior Member
 
Join Date: Sep 2006
Location: San Diego
Posts: 139
Kurka Fund is on a distinguished road
CCI trailing stop

Need some help coding this....

I am trying to measure the Highest/lowest level of the CCI and use it as a "trailing stop".

for example if I am in a long position and the CCI peaks out at 250 I want to exit the position when it comes down to 240.

I have made it work by using 50 different levels and just saying when CCI is higher than level N and comes back down to N. but this is very inefficent.

What i need is a way to store the value of the Highest CCI level . Anyone here know how to do this ?

Thanks,
KK
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-28-2006, 10:51 PM
mikhaildgreat's Avatar
Senior Member
 
Join Date: Nov 2006
Posts: 101
mikhaildgreat is on a distinguished road
Try This

heres how i would approach the problem:

double cci = iCCI(.....);
double ccistop, lastccistop;

if(OrderType()=OP_BUY){
ccistop = cci - 20;
if(ccistop > lastccistop)
{
lastccistop = ccistop;
}
if(lastccistop>=cci)
{
OrderClose(.....);
}
}
if(OrderType()=OP_SELL){
........... etc.
}

I dont know if thats correct I just thought of that right know.

hope that helps,
Mikhail
Quote:
Originally Posted by Kurka Fund
Need some help coding this....

I am trying to measure the Highest/lowest level of the CCI and use it as a "trailing stop".

for example if I am in a long position and the CCI peaks out at 250 I want to exit the position when it comes down to 240.

I have made it work by using 50 different levels and just saying when CCI is higher than level N and comes back down to N. but this is very inefficent.

What i need is a way to store the value of the Highest CCI level . Anyone here know how to do this ?

Thanks,
KK
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-29-2006, 06:52 AM
Kurka Fund's Avatar
Senior Member
 
Join Date: Sep 2006
Location: San Diego
Posts: 139
Kurka Fund is on a distinguished road
Thanks,

But It only works once. I need to reset it after the function is completed. How would you do that?

Quote:
Originally Posted by mikhaildgreat
heres how i would approach the problem:

double cci = iCCI(.....);
double ccistop, lastccistop;

if(OrderType()=OP_BUY){
ccistop = cci - 20;
if(ccistop > lastccistop)
{
lastccistop = ccistop;
}
if(lastccistop>=cci)
{
OrderClose(.....);
}
}
if(OrderType()=OP_SELL){
........... etc.
}

I dont know if thats correct I just thought of that right know.

hope that helps,
Mikhail
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-29-2006, 10:18 AM
mikhaildgreat's Avatar
Senior Member
 
Join Date: Nov 2006
Posts: 101
mikhaildgreat is on a distinguished road
Quote:
Originally Posted by Kurka Fund
Thanks,

But It only works once. I need to reset it after the function is completed. How would you do that?
than put somethig in the begginning of your code that resets the varables.

like:

if (orderstotal()<1)
{
lastccistop = 0;
}

there that should do it... I suggest you make those variable global vars.

Kind regards,
Mikhail
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 Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trailing Stop EA newdigital Expert Advisors - Metatrader 4 48 11-14-2008 06:31 AM
How to set a trailing stop??? theolive9 Metatrader 4 1 12-06-2006 12:12 AM
EA trailing stop JoZo Metatrader 4 6 11-10-2006 02:34 PM


All times are GMT. The time now is 06:13 PM.



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