Announcement

Collapse
No announcement yet.

Programming Help

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

  • Programming Help

    I was wondering if anyone could help me with a programming challenge. In one of my .efs definitions, I have this line that is used to draw a blue circle onto the chart as a trading signal:

    "drawShapeRelative(0, low(0) - offset, Shape.CIRCLE, null , Color.blue , Shape.BOTTOM | Shape.ONTOP | Shape.RIGHT);"

    First, how can I affect the size of the circle it draws? For example, make it bigger or smaller?

    Second, how can I add a line of code to the program that writes the word "Buy" below this circle?

    I would appreciate any suggestions here. TIA..

  • #2
    I have a piece of code here



    called modified brownian motion.efs, which writes long or short on the chart, you could copy that.

    As for the size - I think it is automatic, zooming the chart will increase the size of the circles, but it can't be changed using this method (drawShapeRelative).

    Hope this helps.

    Paul Murray.

    Comment


    • #3
      JKK
      As Paul correctly indicated the size of the shape cannot be changed as it is determined by the spacing of the bars.
      For a workaround you could use drawTextRelative() and set the font type as Wingdings which provides you with two benefits. The first is that by changing the font size parameter you can change the size of the shape and the second is that you have access to a greater selection of shapes.
      For an example of this see the first drawTextRelative() command in the code enclosed below. The Wingdings code for a circle is Alt+108 (this must be typed using the numeric keypad). The size of the ciircle is determined in that example by the second to last parameter currently set to 10.
      To write the Buy text you can use either Paul's example or the one included below in the second drawTextRelative() command.
      Note that in my examples I use the location flags BelowBar1 and BelowBar2 which make it easier to position the text. For further information on drawTextRelative() you may also want to review this article in the EFS KnowledgeBase
      Alex

      PHP Code:
      function preMain(){
          
      setPriceStudy(true);
          
      setShowCursorLabel(false);
      }

      function 
      main(){
          
          if(
      getCurrentBarIndex()==0){
              
      drawTextRelative(0,BelowBar1,"l",Color.blue,null,Text.PRESET|Text.TOP|Text.CENTER,"Wingdings",10,"dot");
              
      drawTextRelative(0,BelowBar2,"Buy",Color.blue,null,Text.PRESET|Text.TOP|Text.CENTER,"Arial",9,"text");
          }

          return;

      Comment


      • #4
        Alex,
        Paul,

        Thanks a lot for your help, I really appreciate it.

        John

        Comment

        Working...
        X