Announcement

Collapse
No announcement yet.

Whats wrong?

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

  • Whats wrong?

    I would like to make a condition like this:
    If CCI is higher than prev CCI and EMA10 is higher than prev EMA10, go long....... and etc

    What numbers should I use on the "offset bar" and the "numbars" settings?

    Is this right?

    if (
    vCCI14.getValue(CCIStudy.CCI) > vCCI14.getValue(CCIStudy.CCI, 1, -1) &&
    vEMA10.getValue(MAStudy.MA) > vEMA10.getValue(MAStudy.MA, 1, -1)


    Please.........
    Attached Files

  • #2
    jonti
    Here is the syntax for your conditions
    Alex

    vCCI14.getValue(CCIStudy.CCI) > vCCI14.getValue(CCIStudy.CCI, -1) &&
    vEMA10.getValue(MAStudy.MA) > vEMA10.getValue(MAStudy.MA, -1)

    Comment


    • #3
      jonti
      FWIW the efs you attached had the conditions written with the correct syntax.
      Also, if I may make a suggestion, you have the following settings for the drawShape:

      if (vLastAlert != 1) drawShapeRelative(0, high(), Shape.DOWNARROW, "", Color.RGB(0,255,0), Shape.TOP);
      and
      if (vLastAlert != 2) drawShapeRelative(0, low(), Shape.UPARROW, "", Color.RGB(0,255,0), Shape.BOTTOM);

      The flags Shape.TOP and Shape.BOTTOM align the shape accordingly ie Shape.TOP aligns the top of the shape to the high() while Shape.BOTTOM aligns the bottom of the shape to the low.
      You may want to reverse these.
      Alex

      Comment


      • #4
        Tnx Alex

        Is this long then?:
        vCCI14.getValue(CCIStudy.CCI) > vCCI14.getValue(CCIStudy.CCI, -1) &&
        vEMA10.getValue(MAStudy.MA) > vEMA10.getValue(MAStudy.MA, -1)

        Comment


        • #5
          jonti
          Yes, assuming that rising values of those two indicators is interpreted by you as a rising market.
          Alex

          Comment

          Working...
          X