Announcement

Collapse
No announcement yet.

Arrows and text

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

  • Arrows and text

    Need some help, to create up and down arrows with text "buy" or "sell" in the barchart for this simple crossover MA strategy.
    (Instead of changing the PricebarColor to blue or red)
    For the formula please have a look to the attached file.

    Would be great, if there is somebody, who can help me. Already I am having my problems with that efs. Still working on it.

    Cordial thanks in advance !

    Goodluck
    Attached Files

  • #2
    try thi

    var study = new MAStudy(15, 0, "Close", MAStudy.SIMPLE);
    var x=0;
    function preMain() {
    setPriceStudy(true);
    }

    function main() {
    var v = study.getValue(MAStudy.MA);

    if(v == null)
    return;


    if(close() >= v) {
    if(!Strategy.isLong()) {
    Strategy.doLong("Crossing Up", Strategy.MARKET, Strategy.THISBAR);
    }

    } else {
    if(!Strategy.isShort()) {
    Strategy.doShort("Crossing Down", Strategy.MARKET, Strategy.THISBAR);
    }
    }

    if(Strategy.isLong()) {
    setPriceBarColor(Color.blue);
    x=x+1;
    drawImageRelative(0, low(), SystemHappyFace, null, Image.BOTTOM,x);
    } else if(Strategy.isShort()) {
    setPriceBarColor(Color.red);
    }


    return v;
    }

    Comment


    • #3
      Goodluck
      FWIW you may want to consider that the strategy will probably give somewhat optimistic results when backtested.
      This is because you are using Strategy.MARKET and Strategy.THISBAR which means that the entries/exits will be calculated on the Open of the bar that generates the signal.
      It may be more realistic to use either Strategy CLOSE and Strategy.THISBAR or Strategy.MARKET and Strategy.NEXTBAR.
      Alex

      Comment


      • #4
        Hi dloomis and Alexis,

        first of all, thank you for your fast reply !

        @ dloomis

        tried your formula, but i received an error : SystemHappyFace is not defined.

        @ Alexis

        Thank you for your reference. I have changed to "Thisbar" and Market" to receive more realistiv results.



        I tried to get this symbols running, but I failed :
        ( after: if Strategy.isLong()) { )
        ........
        setPriceBarColor(Color.blue);
        x=x+1;
        drawShapeRelative(0, low(), Shape.UPARROW, Color.lime, null,x))
        drawTextRelative(-1, low(), "Buy", Color.black, Color.lime, Text.BOLD | Text.ONTOP, null, null));

        } else if (Strategy is.Short()) {
        setPriceBarColor (Color.red);
        x=x-1,
        drawShapeRelative(0, high(), Shape.DOWNARROW, Color.red, null,x))
        drawTextRelative(-1, high(), "Sell", Color.black, Color.red, Text.BOTTOM | Text.BOLD | Text.ONTOP, X));

        }


        return v;
        }

        Where is my fault ? Or am I complete wrong with this ?

        Thx a lot !!!!!!
        Attached Files

        Comment


        • #5
          x=x-1, looks to be the cause...

          try x=x-1;
          Regards,
          Jay F.
          Product Manager
          _____________________________________
          Have a suggestion to improve our products?
          Click Support --> Request a Feature in eSignal 11

          Comment


          • #6
            Hi Jay,

            Thanks for your reply.

            But it doesn't work yet.

            Do you have another idea ? I try to understand the efs, to generate the arrows and the text. For that I had a look to the help center and to several other strategies, but i'm still not further yet.

            Chris
            Last edited by Goodluck; 08-21-2003, 01:53 PM.

            Comment


            • #7
              Chris
              If I may make a suggestion that would be to start from scratch and rebuild the whole efs using the Formula Wizard. You may find it easier and faster than trying to fix the existing formula.
              Alex

              Comment


              • #8
                @ Alex

                I am going to try it over the weekend.

                Thx
                Chris

                Comment

                Working...
                X