Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Triple screen strategy development

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

    Triple screen strategy development

    Hi all,
    I've got an issues with my stretegy based on triple screen by Alexander Elder concept.
    I'm using two timeframes. Weekly for detecting the trend and daily for entering the positions.
    On weekly I'm testing if current price closed above EMA(26) and if MACD is raising (if current bar is above previous one - for bull trend).
    If there is a trend of weekly I'm trying to enter the position on daily by WilliamsR. In other words WilliamsR can't be overbought (above -20) for long positions and oversold (below -80) for short positions.
    But as you can see from the attached screenshot I was executed into short position despite oversold WilliamsR.

    I've run out of bullets already and I'd highly appreciate any hints.



    Thanks in advance!


    Regards,


    Ondrej

    Click image for larger version

Name:	entry.JPG
Views:	1
Size:	94.6 KB
ID:	890451

    ------------------------------------
    Dump of my triple screen strategy:


    protected override void OnBarUpdate()
    {
    if (Position.MarketPosition == MarketPosition.Flat) //no open positions at the moment
    {
    // 1. screen on Weekly
    if (Closes[1][0] > EMA(BarsArray[1],26)[0]
    && (MACD(BarsArray[1],12, 26, 9)[0] > MACD(BarsArray[1],12, 26, 9)[1]))
    {
    //bull trend on weekly chart
    // 2. screen on Daily
    if (WilliamsR(14)[0] < -20)
    {
    SetStopLoss(100);
    EnterLong(DefaultQuantity, "Long");
    stoploss = GetCurrentAsk()-2;
    Print ("Stoploss" +stoploss);
    Print ("%R: " +WilliamsR(14)[0]);
    }

    }

    // 1. screen on Weekly
    if (Closes[1][0] < EMA(BarsArray[1],26)[0]
    && (MACD(BarsArray[1],12, 26, 9)[0] < MACD(BarsArray[1],12, 26, 9)[1]))
    {
    //bear trend on weekly
    // 2. screen on Daily
    if (WilliamsR(14)[0] > -80)
    {
    SetStopLoss(100);
    EnterShort(DefaultQuantity, "Short");
    stoploss = GetCurrentBid()-2;
    Print ("Stoploss" +stoploss);
    Print ("%R: " +WilliamsR(14)[0]);

    }

    }
    }

    Print("Open PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Points));

    if (Position.MarketPosition == MarketPosition.Long && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) > 0 && Close[0] > EMA(13)[0])
    {
    SetStopLoss(CalculationMode.Price, EMA(13)[0]);

    }

    if (Position.MarketPosition == MarketPosition.Short && Position.GetProfitLoss(Close[0], PerformanceUnit.Points) > 0 && Close[0] < EMA(13)[0])
    {
    SetStopLoss(CalculationMode.Price, EMA(13)[0]);

    }
    }

    #2
    You need to break your code into blocks that process OnBarUpdate() for weekly and for daily.

    If you are running on Daily chart and Weekly is secondary then

    Code:
    if (BarsInProgress == 0)
    {
        //Process daily
    }
    else if (BarsInProgress == 1)
    {
        // Process weekly
    }
    Right now, this line

    if (WilliamsR(14)[0] > -80)

    checks for your short condition on both the daily and weekly bars.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray! This seems to solve the problem.


      Regards,


      Ondrej

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      52 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      142 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X