Results 1 to 8 of 8
 5 Attachment(s)    

Thread: SSL Stoch EA Idea

  1. #1

    Exclamation SSL Stoch EA Idea

    I've been fooling around with replacing CCI with SSL in the CCI Stoch Signal EA, but I've run into some weird MQL issue that somehow prevents me from getting anything but a buy signal out of SSL's indicator using iCustom(). I am pretty much out of ideas on how to fix it, as it only happens when the tester or an EA is running -- otherwise, the SSL code works as intended, according to Print() logs. Turn on an EA or run the tester, then all the variables report 0 and SSL only returns 1 for buy. Weird!!

    Let's not allow that to stop us -- someone here can get around this, I'm sure. Why? Because when the market really is having SSL with the green line on top, the SSL Stoch Signal combination makes money like crazy! Here are the rules:

    Enter Buy Order When:

    1) StochSignalIndy gives buy signal (1)
    2) SSL has green line on top
    3) If SSL has green line on bottom, but changes within 3 bars to on top, then enter buy order.

    Enter Sell Order When:

    1) StochSignalIndy gives sell signal (-1)
    2) SSL has red line on top
    3) If SSL has red line on bottom, but changes within 3 bars to on top, then enter sell order.

    At every bar that the buy/sell condition exists, enter another order.

    The logic is similar to CCI Stoch Signal, but this makes more money. At least, in my testing, it makes more money until SSL goes "sell" on the chart, but keeps reporting "buy" to the EA!


    Attached Files Attached Files
    Last edited by MusicMan; 11-23-2009 at 16:07. Reason: Add SSL Indicator

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008


    Hi MM,

    Here is an EA.
    Attached Files Attached Files

  3. #3


    Outstanding! I'll be testing and posting results.

    You are the greatest!


  4. #4



    The EA is testing pretty good, with a 70% plus win ratio over 2008 (a rough year by anyone's standards). I'm optimizing and will post the results later in the week.

    At the same time, I've been looking at how you call the indicators and trying to figure out the reason my original approach did not work. I was trying to reference the Hlv[] buffer, since it already had the 1 or -1 signal values that I normally return from my indicators. In SSL_channel_chart.mq4, this is used to fire the alerts, yet when called from iCustom, I found it only returned 1, never -1 (i. e., always buy, never sell).

    Your method of calling this indy is completely different from mine:

    double sslr=iCustom(NULL,0,"SSL_channel_chart",Lb,0,shift );
    double sslg=iCustom(NULL,0,"SSL_channel_chart",Lb,1,shift );

    double sslra=iCustom(NULL,0,"SSL_channel_chart",Lb,0,shif t+1);
    double sslga=iCustom(NULL,0,"SSL_channel_chart",Lb,1,shif t+1);

    You disregard the Hlv[] array and reference the visible lines. Of course, I tried calculating on the visible indexes in my attempts to have the indicator return 1 or -1, but they only seemed to have readable values within the indicator when the EA or tester was not active (a very odd result).

    I am grateful to be shown a way that does work, but still wondering how to achieve my original goal of having a set of indicators that simply returned buy/sell/neutral signals as 1, -1, or 0. Do you have any light to shed on this issue? Have you encountered similar issues with code that appears logically correct in MQ4, yet does not behave as expected?

    All in all, MQ4 seems a very quirky environment. For example, I have an EA that uses lots of internal arrays to process indicator parameters. It is generally working, but only after I began sizing all of my arrays to have 1 more element than I actually required.

    Oh well... back to work.


  5. #5
    Administrator funyoo's Avatar
    Join Date
    Sep 2008


    Hi MM,

    Yes, your solution is also working.

       double ssl=iCustom(NULL,0,"SSL_channel_chart",Lb,2,shift);
       bool buy=false;
       bool sell=false;
       if(ssl==1){if(reversesignals)sell=true;else buy=true;}
       if(ssl==-1){if(reversesignals)buy=true;else sell=true;}

  6. #6


    Well, that can only mean that something about my parameter-array EA is causing MT4 memory management issues. The first symptom was needing to add the extra array elements to be able to access the last used element. Now, this problem that seemed to implicate the indicator is revealed as my EA causing the problem.

    Actually, this is good news. I can simply remove stuff until it starts working when calling this indicator, allowing me to locate the offending code by process of elimination.

    Another approach might be to carefully add features to your framework until I either get a framework that allows multiple strategies based on preset files, or I break your framework (horrors). Either way, I think it might be a win, either by having more features, or discovering a problem-causing code.

    With the holidays coming, maybe I'll have more coding time, as the markets will be very thin.

    Thanks again,


  7. #7


    OK, here are my first backtesting results. This is for EURUSD H1 for 2008, and the result is a 60% return for the year. Not too shabby, but I have not gone through extensive optimization, just eye-balling the visual trading and adjusting from there. Therefore, a better graph is likely attainable.

    I will continue optimizing and post additional results later in the week.

    BTW, I think I should clarify that the code issues I was chatting with Funyoo about in previous posts are with my own EA, which I have not posted. The Funyoo EAs have no such issues! The SSL Stoch EA is a Funyoo EA 100% -- I only suggested the trading rules. I've been programming in other domains for 25+ years, but I have much to learn on EA coding. :-)

    Attached Images Attached Images SSL Stoch EA Idea-ssl-stoch-ea-eurusd-h1-gif 
    Attached Files Attached Files
    Last edited by MusicMan; 11-25-2009 at 02:43. Reason: clarification

  8. #8
    Junior Member
    Join Date
    Apr 2013


    thank u for u

Similar Threads

  1. Stoch EA
    By funyoo in forum Expert advisors backtesting
    Replies: 14
    Last Post: 07-29-2015, 00:13
  2. EMA RSI Stoch EA
    By funyoo in forum Expert advisors backtesting
    Replies: 4
    Last Post: 03-23-2014, 05:09
  3. Stoch Divergence
    By funyoo in forum Indicators
    Replies: 0
    Last Post: 02-20-2012, 14:31
  4. Stoch On MACD
    By funyoo in forum Indicators
    Replies: 0
    Last Post: 05-10-2011, 15:18
  5. Stoch EA
    By claypot in forum Ideas for expert advisors
    Replies: 4
    Last Post: 02-16-2010, 21:34

Tags for this Thread

100, backtesting, channel, coding, eas, eurusd, how to, indicator, indicators, learn, money, mq4, mql, mt4, news, programming, report, signal, signals, stoch, stop, strategies, time, trading

Posting Permissions

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