Highly adaptable CCI Strategy

Strategies are published here.

Moderator: admin

Re: Highly adaptable CCI Strategy

Postby Apprentice » Fri May 11, 2012 3:03 am

Your request is added to the development list.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 23008
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Highly adaptable CCI Strategy

Postby fxcatty » Fri May 18, 2012 8:35 am

I really need standard code to add to this strategy for it to check the balance of an account. I was hit with a margin call because it kept opening positions! Please just share the code that would check the balance before opening a trade. If the code that would limit the number of open positions! Sorry for the repeat post but I've been hit again.

Thanks,
Matt
fxcatty
 
Posts: 27
Joined: Thu Jul 01, 2010 7:16 pm

Re: Highly adaptable CCI Strategy

Postby fxcatty » Fri May 18, 2012 12:12 pm

fxcatty wrote:I really need standard code to add to this strategy for it to check the balance of an account. I was hit with a margin call because it kept opening positions! Please just share the code that would check the balance before opening a trade. If the code that would limit the number of open positions! Sorry for the repeat post but I've been hit again.

Thanks,
Matt


Okay, So I have been trying this code that has an input of max number of positions per day. I got it from http://fxcodebase.com/code/viewtopic.php?f=31&t=2639&hilit=max+trade&start=100#p25749 ..
Code: Select all
 strategy.parameters:addInteger("MaxTrades", "Max open positions (0 == unlimited)", "", 0, 0, 100);

Code: Select all
local MaxTrades;

Code: Select all
function Prepare(nameOnly)
    -- check moving average parameters
   OB=instance.parameters.OB;
    OS= instance.parameters.OS;
   SIDE= instance.parameters.SIDE;   
    AllowMultiple= instance.parameters.AllowMultiple;
   MaxTrades = instance.parameters.MaxTrades;


Since I have added these parameters in it now allows me to select max number of trades, but the code isn't in the -- check whether the strategy is allowed to trade coding. Could someone who knows how to code finish this please?

Thanks,
Matt
Attachments
Highly adaptable CCI StrategyMaxpos.lua
Incompleted MaxTrades code.
(17.25 KiB) Downloaded 837 times
fxcatty
 
Posts: 27
Joined: Thu Jul 01, 2010 7:16 pm

Re: Highly adaptable CCI Strategy

Postby fxcatty » Fri May 18, 2012 12:25 pm

I realized that when a stop exit is placed in the strategy and max positions are allowed. The trades (all opened) will be liquidated if the initial trades stop loss is hit! I had stop loss set to -30 for the autotrade system.

Example today:

Bought @ 1.26797
Bought @ 1.26627
Bought @ 1.26606
Bought @ 1.26559
Liquidate all of the trades @ 1.26497 ..
Only one of these trades should have been stopped because the low was 1.26422 .

Why isn't each trade open independent of itself?
Like Open 1.26797 Stop 1.26497
Open - 1.26627 Stop - 1.26327
Open - 1.26606 Stop - 1.26306 etc.. ?

All I need for a complete system is to be able to set the MAX number of trades allowed and EACH trade honor the preset stop loss .

Thanks,
Matt
fxcatty
 
Posts: 27
Joined: Thu Jul 01, 2010 7:16 pm

Re: Highly adaptable CCI Strategy

Postby nathanalgren » Thu Sep 13, 2012 2:18 pm

I am testing the zero cross over buy-sell strategy, but it is sometimes ignoring and not executing the trades. Please see the picture.

Image
nathanalgren
 
Posts: 2
Joined: Thu Sep 13, 2012 2:13 pm

Re: Highly adaptable CCI Strategy

Postby guangho » Sat Sep 29, 2012 12:41 pm

HI Apprentice, I 'm a beginner,I want to ask a question。

in the "Highly adaptable CCI Strategy with confirmation"----"Confirmation CCI Parameter"---"Confirmation CCI Levels" --- "Overbought Level" and "Oversold Level".

If “Confirmation CCI Parameter” set “both”,
Whether or not said:
1、ONLY when “Confirmation CCI(50)” More than 75 or Less than -75,To perform the above "The main CCI Parameter(14)" strategy?
2、ONLY when “Confirmation CCI(50)” Between 75 to -75,To perform the above "The main CCI Parameter(14)" strategy?

1 or 2?

My native language is not English, you can understand my question?

Thank you very much!
guangho
 
Posts: 86
Joined: Sat Sep 29, 2012 12:16 pm

Re: Highly adaptable CCI Strategy

Postby Apprentice » Mon Oct 01, 2012 1:54 am

If you use confirmation.
You will have Buy, Sell or Both if confirmation CCI Is within Overbought or Oversold Zone.
With the parameters you are specifying what is permitted in Overbought or Oversold Zone
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 23008
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Highly adaptable CCI Strategy

Postby bfleming » Mon Oct 22, 2012 11:11 am

I've been demo-ing the original Highly Adaptable CCI Strategy (without confirmation). When the strategy is set to trade both direction it closes out open trades when it receives a signal for a trade in the opposite direction even though I don't have any of the actions set to "Close Position". I'm using the following settings:

Overbought Level CrossOver Action: Buy
Overbought Level CrossUnder Action: Sell
Zero Line CrossOver Action: No Action
Zero Line CrossUnder Action: No Action
OversoldLevel CrossOver Action: Buy
Oversold Level CrossUnder Action: Sell

Allow Short/Long/Both Positions: Both
Set Stop Loss: Yes

I'm not sure if the strategy is meant to be this way or if it's a bug, but could you fix/amend the strategy so that it will open opposing positions without closing positions it has already opened. (I tried to run two of the same strategy - one only going long, the other only going short - but the same thing happened.)

Also, does the strategy take signals based on the time period's closing price or on tick data? If tick data, could you amend it take signals on the cose?

Thanks!
bfleming
 
Posts: 29
Joined: Mon Aug 20, 2012 9:42 am

Re: Highly adaptable CCI Strategy

Postby Apprentice » Wed Oct 24, 2012 2:55 am

This is done deliberately.
One of the reasons, if you are a U.S. account holder,
We have FIFO rule as well.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 23008
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Highly adaptable CCI Strategy

Postby fxcatty » Sun Nov 11, 2012 11:03 pm

Hello,

Is there any way you could convert this strategy into MetaTrader 4? It is very useful to me and has allowed me to have success trading, and now I have moved onto MetaTrader via FXCM.

Thanks,
Matt
fxcatty
 
Posts: 27
Joined: Thu Jul 01, 2010 7:16 pm

PreviousNext

Return to Custom Strategies

Who is online

Users browsing this forum: No registered users and 4 guests