Announcement

Collapse
No announcement yet.

help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • help

    I have a efs program that its working parcialy

    sometimes it plots what it is suppose to and

    sometimes it doesn't,

    it plots in some intervals and in some not.

    do you have any idea what could that be?

    have a great day...

    jaime

  • #2
    jaime
    In general that would indicate some logic error in the script. However without seeing the code it is not possible to determine where this error (if any) may be and/or how to correct it.
    In order for someone to be able to offer some guidance you will need to post the script
    Alex

    Comment


    • #3
      help

      I HAVE SOME PROBLEMS WITH THIS CODE,
      SOMETIMES IT GIVES ME THE ALERTS AND SOMETIMES IT DOESN'T
      I WILL REALLY APRECIATE IF YOU COULD TELL ME WHAT YOU SE WRONG.

      THANKS A LOT FOR YOUR HELP,

      HAVE A GREAT DAY.

      ******************************************

      var vBollinger20 = new BollingerStudy(20, "Close", 2);
      var vBollinger20_2 = new BollingerStudy(20, "Close", 3);
      var vLastAlert = -1;

      function preMain() {

      setPriceStudy(true);
      setStudyTitle("B B");
      setCursorLabelName("BB2U", 0);
      setCursorLabelName("BB2M", 1);
      setCursorLabelName("BB2L", 2);
      setCursorLabelName("BB3U", 3);
      setCursorLabelName("BB3M", 4);
      setCursorLabelName("BB3L", 5);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarStyle(PS_SOLID, 1);
      setDefaultBarStyle(PS_SOLID, 2);
      setDefaultBarStyle(PS_SOLID, 3);
      setDefaultBarStyle(PS_SOLID, 4);
      setDefaultBarStyle(PS_SOLID, 5);
      setDefaultBarFgColor(Color.red, 0);
      setDefaultBarFgColor(Color.magenta, 1);
      setDefaultBarFgColor(Color.yellow, 2);
      setDefaultBarFgColor(Color.blue, 3);
      setDefaultBarFgColor(Color.aqua, 4);
      setDefaultBarFgColor(Color.lime, 5);
      setDefaultBarThickness(2, 0);
      setDefaultBarThickness(2, 1);
      setDefaultBarThickness(2, 2);
      setDefaultBarThickness(2, 3);
      setDefaultBarThickness(2, 4);
      setDefaultBarThickness(2, 5);
      setPlotType(PLOTTYPE_LINE, 0);
      setPlotType(PLOTTYPE_LINE, 1);
      setPlotType(PLOTTYPE_LINE, 2);
      setPlotType(PLOTTYPE_LINE, 3);
      setPlotType(PLOTTYPE_LINE, 4);
      setPlotType(PLOTTYPE_LINE, 5);

      }

      function main() {

      if (
      low() > vBollinger20.getValue(BollingerStudy.BASIS) &&
      high() < vBollinger20.getValue(BollingerStudy.UPPER) &&
      hhv(4, high()) >= vBollinger20_2.getValue(BollingerStudy.UPPER)
      ) onAction1()

      else if (
      high() < vBollinger20.getValue(BollingerStudy.BASIS) &&
      low() > vBollinger20.getValue(BollingerStudy.LOWER) &&
      llv(4, low()) <= vBollinger20_2.getValue(BollingerStudy.LOWER)
      ) onAction2();

      return new Array(
      vBollinger20.getValue(BollingerStudy.UPPER),
      vBollinger20.getValue(BollingerStudy.BASIS),
      vBollinger20.getValue(BollingerStudy.LOWER),
      vBollinger20_2.getValue(BollingerStudy.UPPER),
      vBollinger20_2.getValue(BollingerStudy.BASIS),
      vBollinger20_2.getValue(BollingerStudy.LOWER)
      );


      }

      function postMain() {

      }

      function onAction1() {
      if (vLastAlert != 1) Alert.addToList(getSymbol(), "ENTER UP", Color.RGB(0,0,0), Color.RGB(195,0,0));
      if (vLastAlert != 1) drawShapeRelative(0, high(), Shape.CIRCLE, "", Color.RGB(155,0,0), Shape.TOP);

      vLastAlert = 1;

      }

      function onAction2() {
      if (vLastAlert != 2) Alert.addToList(getSymbol(), "ENTER DOWN", Color.RGB(0,0,0), Color.RGB(195,0,0));
      if (vLastAlert != 2) drawShapeRelative(0, low(), Shape.CIRCLE, "", Color.RGB(155,0,0), Shape.BOTTOM);

      vLastAlert = 2;

      }

      Comment


      • #4
        Hello jaimeog,

        There aren't any problems with your formula code. Your alert conditions are just very restrictive. I ran this on 20 days of 1-min data on ES #F and only receive 13 signals.

        To see where the signals are occurring it would help to plot the hhv() and llv() series that you are using in your conditions. Then in your onAction functions add the following debugPrintln() statements so you can see which historical bar indexes are triggering the alerts. Be sure to open your formula output window (Tools-->EFS).

        PHP Code:
        function onAction1() {
            if (
        vLastAlert != 1) {
                
        debugPrintln("Bar: " getCurrentBarIndex() + "  Enter Up!");
                
        Alert.addToList(getSymbol(), "ENTER UP"Color.RGB(0,0,0), Color.RGB(195,0,0));
            }
            if (
        vLastAlert != 1drawShapeRelative(0high(), Shape.CIRCLE""Color.RGB(155,0,0), Shape.TOP);
            
            
        vLastAlert 1;
            
        }

        function 
        onAction2() {
            if (
        vLastAlert != 2) {
                
        debugPrintln("Bar: " getCurrentBarIndex() + "  Enter Down!");
                
        Alert.addToList(getSymbol(), "ENTER DOWN"Color.RGB(0,0,0), Color.RGB(195,0,0));
            }
            if (
        vLastAlert != 2drawShapeRelative(0low(), Shape.CIRCLE""Color.RGB(155,0,0), Shape.BOTTOM); 
            
            
        vLastAlert 2;
            

        P.S. By the way, typing in all caps is perceived by many as shouting. The tone of your message certainly did not convey shouting so just thought I'd let you know.
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment

        Working...
        X