Announcement

Collapse
No announcement yet.

DrawShapeRelative and CPU

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

  • DrawShapeRelative and CPU

    I am still trying to figure this out. I have looked at the code Brad has sent me and I am still srewing something up. I only want to display the last five shapes in my study to conserve cpu time. I have two functions one for sell and on for buy that my studies call they are as follows

    function sell(){
    if (getBarState() == BARSTATE_NEWBAR) {
    if (varcounter > 5)
    varcounter = 0;
    else varcounter++
    }

    DrawShapeRelative(0, high()+.1,Shape.DOWNARROW,"",Color.red,Shape.BOTTO M,+varcounter);

    }

    my function buy() is the sam thing except i am using a down arrow.

    I also defined my var varcounter before the main.

  • #2
    Hello jnorton,

    Your drawShapeRelative() function needs to have a lower case "d." Also, the parameter for your tag name needs to be a concatenated string that includes the varcounter variable. Try using "sell"+varcounter for the tag name property. Another potential problem you might be having could be related to the varcounter logic being inside your sell() function. Is the sell() function only getting called at BARSTATE_NEWBAR? If it is then you should be ok. If the sell() function can be called intra-bar then the varcounter variable will not be properly incremented.
    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