Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

output text on strategy optimiser chart

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

    output text on strategy optimiser chart

    Hi,

    I have been playing around modifying strategies in the strategy optimiser code and I want to check when my code logic lets a trade ride instead of closing out I am really struggling to get it to work,

    I have tried using DrawTextFixed() and DrawDiamond() (just in case text was the issue) and I get no (my) text on the chart and only a red diamond on the last bar

    I'm using imported daily data

    any one have any ideas where to go next

    thx

    ian

    #2
    Originally posted by hyena View Post
    Hi,

    I have been playing around modifying strategies in the strategy optimiser code and I want to check when my code logic lets a trade ride instead of closing out I am really struggling to get it to work,

    I have tried using DrawTextFixed() and DrawDiamond() (just in case text was the issue) and I get no (my) text on the chart and only a red diamond on the last bar

    I'm using imported daily data

    any one have any ideas where to go next

    thx

    ian
    Not without seeing the errant code.

    Comment


      #3
      Thanks koganam - Ian could you share the code snippets you used? If you apply the same strategy on a chart - any other behavior seen then?

      Thanks,

      Comment


        #4
        hi,

        Sorry about this, i had googled around and was pretty certain the answer would have been a ninja restriction on putting text/symbols on to SA charts from within the strategy code :

        heres a snippet of the simple code ive been using to try get the text/symbols show (didnt keep the various iterations of trying to get text to show) before putting itim my working strategies

        -------------------------------------

        /// This method is used to configure the strategy and is called once before any strategy method is called.
        /// </summary>
        protected override void Initialize()
        {
        CalculateOnBarClose = false;
        }
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
        if (CurrentBar < 1) return;
        if ((High[0]-Low[0]) >1)
        {
        DrawDiamond("tag1", true, 0, Low[0] - TickSize, Color.Red);
        }

        ---------------------------------------------------------------------

        Comment


          #5
          Originally posted by hyena View Post
          hi,

          Sorry about this, i had googled around and was pretty certain the answer would have been a ninja restriction on putting text/symbols on to SA charts from within the strategy code :

          heres a snippet of the simple code ive been using to try get the text/symbols show (didnt keep the various iterations of trying to get text to show) before putting itim my working strategies

          -------------------------------------

          /// This method is used to configure the strategy and is called once before any strategy method is called.
          /// </summary>
          protected override void Initialize()
          {
          CalculateOnBarClose = false;
          }
          /// <summary>
          /// Called on each bar update event (incoming tick)
          /// </summary>
          protected override void OnBarUpdate()
          {
          if (CurrentBar < 1) return;
          if ((High[0]-Low[0]) >1)
          {
          DrawDiamond("tag1", true, 0, Low[0] - TickSize, Color.Red);
          }

          ---------------------------------------------------------------------
          Provided that your conditions are met that will draw EXACTLY one diamond on your chart, at the last position that met the conditions.

          That is because you are using a fixed tag, so every time that the diamond is drawn, it is drawing the same exact object, just at a different place.

          If you want to see all drawn objects, you need unique tags. The commonest method used in these parts is to concatenate the CurrentBar into the tag thus: "tagPrefix" + CurrentBar.To String(), as the CurrentBar is guaranteed to be uniquely mapped 1 to 1 to the chart bars.
          Last edited by koganam; 09-22-2011, 06:20 PM.

          Comment


            #6
            Hi guys,

            many thx .. had a bash and worked perfectly, for others benefit here are the lines i used to test it works with text and symbols (diamonds in this case) :

            n.b. the "-L-" is the text i had it print on top of particular bars that met the condition in the IF statement and the "L-ROLLOVER" is the tag name which can be anything


            DrawText("L_ROLLOVER"+ CurrentBar, "-L-", 0, High[0]+2, Color.Red);

            DrawDiamond("L_ROLLOVER"+ CurrentBar, true, 0, Low[0]-2, Color.Red);

            b.r.

            ian

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            648 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X