Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing from a strategy or from an indicator

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

    Drawing from a strategy or from an indicator

    Could anyone explain to me the reason why, when I put this code in a strategy script, it draws Fibonacci retracements over my chart but when I put it in an indicator it does not.

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (High[0] == MAX(High, 34)[0])
    {
    RemoveDrawObjects();
    DrawFibonacciRetracements("My fibonacci retracements" + CurrentBar, 1, MIN(Low, 34)[0], 0, High[0]);
    PlaySound("DRUM.wav");
    }
    // Condition set 2
    if (Low[0] == MIN(Low, 34)[0])
    {
    RemoveDrawObjects();
    DrawFibonacciRetracements("My fibonacci retracements" + CurrentBar, 1, MAX(High, 34)[0], 0, Low[0]);
    PlaySound("REMD.wav");
    }
    // Condition set 3
    if (CrossAbove(Close, SMA(Close, 100), 1))
    {
    PlaySound("ringout.wav");
    }
    // Condition set 4
    if (CrossBelow(Close, SMA(Close, 100), 1))
    {
    PlaySound("online.wav");
    }
    }

    Gérard

    #2
    Not sure I follow. Are you saying that putting this strategy on chart will draw the fib retracements and as you then add another indicator like e.g. SMA to the the same chart the fib retracements are gone?

    Please clarify. Thanks

    Comment


      #3
      When I use Market Replay for 06/25/07 here is what happens :

      - experiment 1
      . I attach the strategy : fib retracements immediately appear on the chart which happened to be previously displayed on my screen;
      . I start to replay from the very beginning and then :
      - on the 15th candle, a swing low happens : I can hear the sound and the fibs are drawn over the current candle
      - on the 22th candle, a swing high happens : sound again and the fibs are drawn over the current candle

      - experiment 2
      . I get rid of any strategy and attach the same code inside an indicator : no fibs appear
      . I restart the playing and then
      - on the 15th candle, same swing low : no sound, no fibs
      - on the 22th candle, same swing high : no sound, no fibs.

      I wish I could have my fibs automatically drawn from an indicator which I would attach to my default template and which would allow me to use chart trader

      Comment


        #4
        Then likely the conditions in your indicator which trigger the drawing of the fibs never become true. Please verify by placing Print() statements instead of the drawing statements.

        Next steps: Please try to understand why your conditions do not become true by simplifying your indicator until it finally works as expected.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by lightsun47, Today, 03:51 PM
        0 responses
        2 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        8 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        42 views
        0 likes
        Last Post futtrader  
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        13 views
        0 likes
        Last Post bltdavid  
        Started by port119, Today, 02:43 PM
        0 responses
        8 views
        0 likes
        Last Post port119
        by port119
         
        Working...
        X