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 judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        55 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        35 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        6 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        19 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        7 views
        0 likes
        Last Post cre8able  
        Working...
        X