Page 3 of 6 FirstFirst 12345 ... LastLast
Results 21 to 30 of 52
  23 23 Attachment(s)    

Thread: i-CAi Expert Advisor

  1. #21
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,011

    Default

    Quote Originally Posted by pillso View Post
    how work this EA?
    i need that
    if candle close over icai buy
    if candle close under icai close position+sell
    this EA make that?
    Yes it does that.

  2. #22

    Default

    i use i cai ma 65 in 5min
    its great when big move like this night
    but in range trading its really bad
    i have a idea for limit fake signal
    add elder inpulse candle in the ea
    elder candle have 3 color
    lime=buy
    blue=wait and see
    red=sell
    exemple
    if bar close over icai and candle lime=buy and after if bar close under icai and bar is blue always buy; if bar close under icai and bar red sell

    i have look it today and it limit fake signal
    so if u have other idea for limit fake signal u is welcome;-)
    here the indiacator

    //+------------------------------------------------------------------+
    //| Heiken Ashi.mq4 |
    //| Copyright c 2004, MetaQuotes Software Corp. |
    //| Forex Trading Software: Forex Trading Platform MetaTrader 4 |
    //+------------------------------------------------------------------+
    #property copyright "Copyright © 2004, MetaQuotes Software Corp."
    #property link "http://www.metaquotes.net"

    #property indicator_chart_window
    #property indicator_buffers 4
    #property indicator_color1 Red
    #property indicator_color2 Lime
    #property indicator_color3 Blue
    #property indicator_color4 Blue
    #property indicator_width1 3
    #property indicator_width2 3
    #property indicator_width3 3
    #property indicator_width4 3

    extern int TimeFrame=0;
    extern int EMA_Period=13;
    extern int MACD_FastPeriod=12;
    extern int MACD_SlowPeriod=26;
    extern int MACD_SignalPeriod=9;
    extern bool UseMT4MACD=false;

    //---- buffers
    double ExtMapBuffer1[];
    double ExtMapBuffer2[];
    double ExtMapBuffer3[];
    double ExtMapBuffer4[];

    double MACDLineBuffer[];
    double MACDSignalLineBuffer[];
    double MACDHistogramBuffer[];

    //----
    int ExtCountedBars=0;
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function |
    //|------------------------------------------------------------------|
    int init()
    {
    IndicatorBuffers(7);

    //---- indicators
    SetIndexStyle(0,DRAW_HISTOGRAM, 0, 3);
    SetIndexBuffer(0, ExtMapBuffer1);
    SetIndexStyle(1,DRAW_HISTOGRAM, 0, 3);
    SetIndexBuffer(1, ExtMapBuffer2);
    SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3);
    SetIndexBuffer(2, ExtMapBuffer3);
    SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3);
    SetIndexBuffer(3, ExtMapBuffer4);
    //----
    SetIndexDrawBegin(0,MACD_SlowPeriod);
    SetIndexDrawBegin(1,MACD_SlowPeriod);
    SetIndexDrawBegin(2,MACD_SlowPeriod);
    SetIndexDrawBegin(3,MACD_SlowPeriod);

    //---- indicator buffers mapping
    SetIndexBuffer(0,ExtMapBuffer1);
    SetIndexBuffer(1,ExtMapBuffer2);
    SetIndexBuffer(2,ExtMapBuffer3);
    SetIndexBuffer(3,ExtMapBuffer4);

    SetIndexEmptyValue(4,0.0);
    SetIndexBuffer(4,MACDSignalLineBuffer);
    SetIndexEmptyValue(5,0.0);
    SetIndexBuffer(5,MACDLineBuffer);
    SetIndexEmptyValue(6,0.0);
    SetIndexBuffer(6,MACDHistogramBuffer);
    //---- initialization done

    return(0);
    }
    //+------------------------------------------------------------------+
    //| Custom indicator deinitialization function |
    //+------------------------------------------------------------------+
    int deinit()
    {
    //---- TODO: add your code here

    //----
    return(0);
    }
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function |
    //+------------------------------------------------------------------+
    int start()
    {
    int limit,y=0,counted_bars=IndicatorCounted();
    double ema1, main1, signal1, ema0, main0, signal0, macd1, macd0, main;
    double alpha = 2.0 / (MACD_SignalPeriod + 1.0);
    double alpha_1 = 1.0 - alpha;
    double BarValue, aOpen, aClose;

    if(Bars<=10) return(0);
    ExtCountedBars=IndicatorCounted();
    //---- check for possible errors
    if (ExtCountedBars<0) return(-1);
    //---- last counted bar will be recounted
    if (ExtCountedBars>0) ExtCountedBars--;
    int pos=Bars-ExtCountedBars-1;
    while(pos>=0)
    {
    y = iBarShift(NULL,TimeFrame,Time[pos]);
    ema0=iMA(NULL,TimeFrame,EMA_Period,0,MODE_EMA,PRIC E_CLOSE,y);
    ema1=iMA(NULL,TimeFrame,EMA_Period,0,MODE_EMA,PRIC E_CLOSE,y+1);

    if(UseMT4MACD)
    {
    main0=iMACD(NULL, TimeFrame, MACD_FastPeriod, MACD_SlowPeriod, MACD_SignalPeriod, PRICE_CLOSE,0,y);
    main1=iMACD(NULL, TimeFrame, MACD_FastPeriod, MACD_SlowPeriod, MACD_SignalPeriod, PRICE_CLOSE,0,y+1);

    signal0=iMACD(NULL, TimeFrame, MACD_FastPeriod, MACD_SlowPeriod, MACD_SignalPeriod, PRICE_CLOSE,1,y);
    signal1=iMACD(NULL, TimeFrame, MACD_FastPeriod, MACD_SlowPeriod, MACD_SignalPeriod, PRICE_CLOSE,1,y+1);

    main=main0;
    macd0=main0-signal0;
    macd1=main1-signal1;
    } else
    {
    MACDLineBuffer[y] = iMA(NULL,TimeFrame,MACD_FastPeriod,0,MODE_EMA,PRIC E_CLOSE,y)-
    iMA(NULL,TimeFrame,MACD_SlowPeriod,0,MODE_EMA,PRIC E_CLOSE,y);
    MACDSignalLineBuffer[y]=(alpha*MACDLineBuffer[y]) + (alpha_1*MACDSignalLineBuffer[y+1]);
    MACDHistogramBuffer[y]=MACDLineBuffer[y]-MACDSignalLineBuffer[y];

    main=MACDLineBuffer[y];
    macd0=MACDHistogramBuffer[y];
    macd1=MACDHistogramBuffer[y+1];
    }
    aOpen=Open[pos];
    aClose=Close[pos];
    if(ema0<ema1 && macd0<macd1) //both down - Red
    {
    if(aOpen<aClose)
    {
    ExtMapBuffer1[pos]=aClose;
    ExtMapBuffer2[pos]=aOpen;
    ExtMapBuffer3[pos]=EMPTY_VALUE;
    ExtMapBuffer4[pos]=EMPTY_VALUE;
    } else
    {
    ExtMapBuffer1[pos]=aOpen;
    ExtMapBuffer2[pos]=aClose;
    ExtMapBuffer3[pos]=EMPTY_VALUE;
    ExtMapBuffer4[pos]=EMPTY_VALUE;
    }
    } else
    if(ema0>ema1 && macd0>macd1) //both up - Lime
    {
    if(aOpen<aClose)
    {
    ExtMapBuffer1[pos]=aOpen;
    ExtMapBuffer2[pos]=aClose;
    ExtMapBuffer3[pos]=EMPTY_VALUE;
    ExtMapBuffer4[pos]=EMPTY_VALUE;
    } else
    {
    ExtMapBuffer1[pos]=aClose;
    ExtMapBuffer2[pos]=aOpen;
    ExtMapBuffer3[pos]=EMPTY_VALUE;
    ExtMapBuffer4[pos]=EMPTY_VALUE;
    }
    } else //otherwise - Blue
    {
    ExtMapBuffer3[pos]=aOpen;
    ExtMapBuffer4[pos]=aClose;
    ExtMapBuffer1[pos]=EMPTY_VALUE;
    ExtMapBuffer2[pos]=EMPTY_VALUE;
    }
    pos--;
    }
    //----
    return(0);
    }
    //+------------------------------------------------------------------+

  3. #23
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,011

    Default

    Quote Originally Posted by pillso View Post
    i use i cai ma 65 in 5min
    its great when big move like this night
    but in range trading its really bad
    i have a idea for limit fake signal
    add elder inpulse candle in the ea
    elder candle have 3 color
    lime=buy
    blue=wait and see
    red=sell
    exemple
    if bar close over icai and candle lime=buy and after if bar close under icai and bar is blue always buy; if bar close under icai and bar red sell

    i have look it today and it limit fake signal
    so if u have other idea for limit fake signal u is welcome;-)
    here the indiacator
    Hi pillso,

    Interesting idea,

    Here is the EA.


    Attached Files Attached Files

  4. #24

    Default

    thank u funnyo great job
    i test that today for watch if it work;-)

  5. #25

    Default

    finnaly with sma 65 it dont look good icai dont move fast
    i have optimized icai it look good now
    u can add a filter to the EA?;-)

    if candle lime close over icai+Laguerre RSI over 0.45=buy
    if candle red close under icai+Laguerre RSI under 0.45=sell


    here the indicator

    //+------------------------------------------------------------------+
    //| Laguerre RSI.mq4 |
    //| Copyright © 2005, David W. Thomas |
    //| mailto:davidwt@usa.net |
    //+------------------------------------------------------------------+
    // based on http://www.mesasoftware.com/TimeWarp.doc.
    #property copyright "Copyright © 2005, David W. Thomas"
    #property link "mailto:davidwt@usa.net"
    //----
    #property indicator_separate_window
    #property indicator_level2 0.75
    #property indicator_level3 0.45
    #property indicator_level4 0.15
    #property indicator_minimum 0
    #property indicator_maximum 1
    #property indicator_buffers 1
    #property indicator_color1 MediumPurple
    //---- input parameters
    extern double gamma=0.7;
    //---- buffers
    double RSI[];
    double L0[];
    double L1[];
    double L2[];
    double L3[];
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function |
    //+------------------------------------------------------------------+
    int init()
    {
    IndicatorBuffers(5);
    //---- indicators
    SetIndexStyle(0, DRAW_LINE);
    SetIndexDrawBegin(0, 1);
    SetIndexLabel(0, "Laguerre RSI");
    SetIndexEmptyValue(0, -0.01);
    SetIndexBuffer(0, RSI);
    SetIndexBuffer(1, L0);
    SetIndexBuffer(2, L1);
    SetIndexBuffer(3, L2);
    SetIndexBuffer(4, L3);
    //----
    string short_name="LaguerreRSI(" + DoubleToStr(gamma, 2) + ")";
    IndicatorShortName(short_name);
    return(0);
    }
    //+------------------------------------------------------------------+
    //| Custor indicator deinitialization function |
    //+------------------------------------------------------------------+
    int deinit()
    {
    return(0);
    }
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function |
    //+------------------------------------------------------------------+
    int start()
    {
    int limit;
    int counted_bars=IndicatorCounted();
    double CU, CD;
    //---- last counted bar will be recounted
    if (counted_bars>0)
    counted_bars--;
    else
    counted_bars=1;
    limit=Bars - counted_bars;
    //---- computations for RSI
    for(int i=limit; i>=0; i--)
    {
    L0[i]=(1.0 - gamma)*Close[i] + gamma*L0[i+1];
    L1[i]=-gamma*L0[i] + L0[i+1] + gamma*L1[i+1];
    L2[i]=-gamma*L1[i] + L1[i+1] + gamma*L2[i+1];
    L3[i]=-gamma*L2[i] + L2[i+1] + gamma*L3[i+1];
    //Print(i," Close[i]=",Close[i],", (1.0 - gamma)*Close[i]=",(1.0 - gamma)*Close[i],", gamma*L0[i+1]=",gamma*L0[i+1]);
    //Print(i," L0=",L0[i],",L1=",L1[i],",L2=",L2[i],",L3=",L3[i]);
    CU=0;
    CD=0;
    if (L0[i]>=L1[i])
    CU=L0[i] - L1[i];
    else
    CD=L1[i] - L0[i];
    if (L1[i]>=L2[i])
    CU=CU + L1[i] - L2[i];
    else
    CD=CD + L2[i] - L1[i];
    if (L2[i]>=L3[i])
    CU=CU + L2[i] - L3[i];
    else
    CD=CD + L3[i] - L2[i];
    if (CU + CD!=0)
    RSI[i]=CU/(CU + CD);
    }
    return(0);
    }
    //+------------------------------------------------------------------+

  6. #26
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,011

    Default



    Ok here it is.

    EU H1. On one year. System reversed.

    Total net profit : 236.38%
    RDD : 29.01%
    Attached Images Attached Images i-CAi Expert Advisor-strategytester-i-cai-heiken-ashi-laguerre-rsi-ea-eu-h1-gif 
    Attached Files Attached Files

  7. #27

    Default

    thank u
    i have a last demand ;-)
    u can make a version with this indicator for test the best

    //+------------------------------------------------------------------+
    //| Inverse Fisher Transform of RSI.mq4 |
    //| Treberk's Conversion |
    //| Treberk's Conversion |
    //+------------------------------------------------------------------+
    #property copyright "Treberk's Conversion"
    #property link "Treberk's Conversion"

    #property indicator_separate_window
    #property indicator_buffers 2
    #property indicator_color1 Red
    #property indicator_color2 DimGray


    //Inputs

    extern int RsiBars=5; // default=5
    extern int WmaBars=9; // default=9
    extern int HiTrigger=0.5; // default=0.5
    extern int LoTrigger=-0.5; // default=-0.5
    extern bool info=0; // default=0


    //---- buffers
    double ExtMapBuffer1[];
    double ExtMapBuffer2[];
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function |
    //+------------------------------------------------------------------+
    int init()
    {
    //---- indicators
    SetIndexStyle(0,DRAW_LINE);
    SetIndexBuffer(0,ExtMapBuffer1);
    SetIndexStyle(1,DRAW_LINE);
    SetIndexBuffer(1,ExtMapBuffer2);
    //----
    return(0);
    }
    //+------------------------------------------------------------------+
    //| Custor indicator deinitialization function |
    //+------------------------------------------------------------------+
    int deinit()
    {
    //----

    //----
    return(0);
    }
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function |
    //+------------------------------------------------------------------+
    int start()
    {
    int counted_bars=IndicatorCounted();
    //----

    // SetLoopCount(0);
    //--------------------------------------------------------

    //Variables: // Generic
    int shift;
    int loopBegin;
    bool is_First=True;
    double prevbars;
    int count;

    //Variables: // Specific
    // Name(\"InvFisher RSI\"),
    double Value2;
    double IFish;
    // for manual calc. RSI
    double SumUp;
    double SumDn;
    double AvgUp;
    double AvgDn;
    double Delta;
    double RSI;
    // for calc. WMA
    double WmaNumerator;
    double WmaDenominator;
    datetime LastTime;
    double PrevAvgUp;
    double PrevAvgDn;
    int cntdown;

    //Arrays:
    // for ( calc. generic WMA (weighted moving average)
    double Value1[40];




    // Usage
    /*[if (info ) {
    Alert(\"See Terminal>Journal Tab for ( usage of \\n\",Name);
    Print(\"|___________________\");
    Print(\"|* \",Name,\" *\");
    Print(\"| \",\"Sell: cross under HiTrigger (or under LoTrigger if (no prior cross under HiTrigger)\");
    Print(\"| \",\"Buy: cross over LoTrigger (or over HiTrigger if (no prior cross over LoTrigger)\");
    Print(\"|* \",Name,\" *\");
    Print(\"|```````````````````\");
    }]*/
    //--------------------------------------------------------

    // Check Inputs
    if (0>HiTrigger || HiTrigger>1 ) {
    Alert("Input Error: must be 0< HiTrigger <1, Cannot=",HiTrigger);
    return(0);
    }
    if (-1>LoTrigger || LoTrigger>0 ) {
    Alert("Input Error: must be -1< LoTrigger <0, Cannot=",LoTrigger);
    return(0);
    }
    if (0>RsiBars || RsiBars>50 ) {
    Alert("Input Error: must be 0< RsiBars <50, Cannot=",RsiBars);
    return(0);
    }
    //--------------------------------------------------------

    // Check for ( additional bars loading or total reloadng.
    if (Bars<prevbars || Bars-prevbars>1 ) is_First=True;
    prevbars=Bars;
    //--------------------------------------------------------

    // Pre-Loop setup
    // loopbegin prevents counting of previously plotted bars excluding current Bars
    if (is_First ) {
    loopBegin=Bars-1-1;// BarIndexNumber=Shift=Bars-1...0

    // Compute the initial AvgUp & AvgDn for RSI
    for ( shift=loopBegin; shift>=loopBegin-RsiBars; shift--) {
    Delta=Close[shift]-Close[shift+1];
    SumUp=SumUp+MathMax(0,Delta);
    SumDn=SumDn-MathMin(0,Delta);
    }
    AvgUp=SumUp/RsiBars;
    AvgDn=SumDn/RsiBars;
    loopBegin=loopBegin-RsiBars;
    }
    //--------------------------------------------------------

    // loop from loopbegin to current bar (shift=0)
    if (! is_First ) {
    if ((Time[0]!=LastTime) ) {
    PrevAvgUp = AvgUp;
    PrevAvgDn = AvgDn;
    AvgUp = 0;
    AvgDn = 0;
    for ( count=WmaBars-1; count>=1; count--) {
    Value1[count]=Value1[count-1];
    }
    LastTime = Time[0];
    }
    } else {
    cntdown = 1;
    }

    for ( shift=loopBegin; shift>=cntdown; shift--) {
    // Calc RSI manually
    Delta=Close[shift]-Close[shift+1];
    if (is_First ) {
    AvgUp=((RsiBars-1)*AvgUp+MathMax(0,Delta))/RsiBars;
    AvgDn=((RsiBars-1)*AvgDn-MathMin(0,Delta))/RsiBars;
    } else {
    AvgUp=((RsiBars-1)*PrevAvgUp+MathMax(0,Delta))/RsiBars;
    AvgDn=((RsiBars-1)*PrevAvgDn-MathMin(0,Delta))/RsiBars;
    }
    RSI=100-100/(1+AvgUp/AvgDn);
    // ) scale RSI to between -5 and +5
    /* Do not use iRSI fctn because it\'s too slow
    Value1=0.1*(iRSI(RsiBars,shift)-50); */
    Value1[0]=0.1*(RSI-50);

    // Use weighted moving average to smooth Value1.
    // Ehler suggests could also use EMA, which would be simpler coding at the expense of Alpha.
    WmaNumerator=0;
    WmaDenominator=0;
    for ( count=WmaBars; count>= 1; count--) {
    WmaNumerator=WmaNumerator+count*Value1[WmaBars-count-1];
    WmaDenominator=WmaDenominator+count;
    }
    Value2=WmaNumerator/WmaDenominator;
    IFish=(MathExp(2*Value2)-1)/(MathExp(2*Value2)+1);

    ExtMapBuffer1[shift]=IFish;
    // SetIndexValue[shift]=RSI;

    // Plot dual-value Trigger Line
    if (IFish >0 )
    ExtMapBuffer2[shift]=HiTrigger;
    else
    ExtMapBuffer2[shift]=LoTrigger;
    //--------------------------------------------------------

    // Update arrays. This technique minimizes array storage and thus allows more signal bars.
    if (is_First ) for ( count=WmaBars-1; count>= 1; count--) {
    Value1[count]=Value1[count-1];
    }
    //--------------------------------------------------------
    }

    is_First = False;
    cntdown = 0;
    loopBegin = 0;


    //----
    return(0);
    }
    //+------------------------------------------------------------------+

  8. #28

    Default

    i have a problem with EA
    it work good
    but after 4 to 5 trade
    it dont work no more trade
    same problem this afternoon and tonight
    who can help?

  9. #29
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,011

    Default

    Quote Originally Posted by pillso View Post
    i have a problem with EA
    it work good
    but after 4 to 5 trade
    it dont work no more trade
    same problem this afternoon and tonight
    who can help?
    You have maybe enabled the time filter ?



    Here is the version with Inverse Fisher Transform of RSI. I have not tested it as we can't backtest this indicator.
    Attached Files Attached Files

  10. #30

    Default

    thank for your fantastic job!

    i have time filter false

    its maybe because its demo account?

Similar Threads

  1. SAR ADX Expert Advisor
    By funyoo in forum Expert advisors backtesting
    Replies: 29
    Last Post: 07-01-2015, 16:43
  2. Enable/Disable Expert advisor Button By Expert advsior
    By Trint in forum Ideas for expert advisors
    Replies: 1
    Last Post: 10-18-2010, 10:41
  3. SAR ADX Expert Advisor
    By funyoo in forum Expert advisors live statements
    Replies: 0
    Last Post: 02-10-2009, 13:27

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


GadgetVersus GadgetVersus France W3Ask W3Ask Brasil W3Ask Deutschland W3Ask España W3Ask France W3Ask Italia W3Ask Nederland