Category Other  Published on 15/08/2019

Strong vs Weak Analysis

Description

Based on the method as used in the following BP thread: https://forums.babypips.com/t/trading-the-trend-with-strong-weak-analysis/

A few notes:

  • Calculates and displays the strength of each currency relative to JPY.
  • Calculation is performed on 4HR timeframe against the 200SMA
  • JPY strength will always be 0 relative to the other currencies
  • Can be ran on any chart, as it will always look at the same currencies
  • I recommend you run it on the Daily timeframe
  • Can take 30 to 60s to load

Suggested screen setup:


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Levels(-4, -2, 0, 2, 4)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CurrencyStrengthJPY : Indicator
    {
        [Output("USD", LineColor = "DarkGreen")]
        public IndicatorDataSeries USD { get; set; }

        [Output("AUD", LineColor = "Red")]
        public IndicatorDataSeries AUD { get; set; }

        [Output("CAD", LineColor = "Blue")]
        public IndicatorDataSeries CAD { get; set; }

        [Output("NZD", LineColor = "Brown")]
        public IndicatorDataSeries NZD { get; set; }

        [Output("CHF", LineColor = "White")]
        public IndicatorDataSeries CHF { get; set; }

        [Output("EUR", LineColor = "GreenYellow")]
        public IndicatorDataSeries EUR { get; set; }

        [Output("GBP", LineColor = "Gold")]
        public IndicatorDataSeries GBP { get; set; }

        private MarketSeries sUSD, sAUD, sCAD, sNZD, sCHF, sEUR, sGBP;

        protected override void Initialize()
        {
            TimeFrame tf = TimeFrame.Hour4;

            sUSD = MarketData.GetSeries("USDJPY", tf);
            sAUD = MarketData.GetSeries("AUDJPY", tf);
            sCAD = MarketData.GetSeries("CADJPY", tf);
            sNZD = MarketData.GetSeries("NZDJPY", tf);
            sCHF = MarketData.GetSeries("CHFJPY", tf);
            sEUR = MarketData.GetSeries("EURJPY", tf);
            sGBP = MarketData.GetSeries("GBPJPY", tf);

            Chart.DrawStaticText("1", "1. Identify strongest pair (must be >2% difference)", VerticalAlignment.Top, HorizontalAlignment.Left, Color.Yellow);
            Chart.DrawStaticText("2", "\n" + "2. Confirm trade is in daily/weekly direction", VerticalAlignment.Top, HorizontalAlignment.Left, Color.Yellow);
            Chart.DrawStaticText("3", "\n\n" + "3. Draw Support/Resistance", VerticalAlignment.Top, HorizontalAlignment.Left, Color.Yellow);
            Chart.DrawStaticText("4", "\n\n\n" + "4. Plot on H1 against 200SMA", VerticalAlignment.Top, HorizontalAlignment.Left, Color.Yellow);
            Chart.DrawStaticText("5", "\n\n\n\n" + "5. Idenitify Entry/Exit", VerticalAlignment.Top, HorizontalAlignment.Left, Color.Yellow);
        }

        public override void Calculate(int index)
        {
            var dUSD = (double)(getResult(sUSD, USD, index)) / 100;
            var dAUD = (double)(getResult(sAUD, AUD, index)) / 100;
            var dCAD = (double)(getResult(sCAD, CAD, index)) / 100;
            var dNZD = (double)(getResult(sNZD, NZD, index)) / 100;
            var dCHF = (double)(getResult(sCHF, CHF, index)) / 100;
            var dEUR = (double)(getResult(sEUR, EUR, index)) / 100;
            var dGBP = (double)(getResult(sGBP, GBP, index)) / 100;

            Chart.DrawStaticText("Labels", "USD:" + "\t\t\n" + "AUD:" + "\t\t\n" + "CAD:" + "\t\t\n" + "NZD:" + "\t\t\n" + "CHF:" + "\t\t\n" + "EUR:" + "\t\t\n" + "GBP:" + "\t\t", VerticalAlignment.Top, HorizontalAlignment.Right, Color.Yellow);
            Chart.DrawStaticText("USD", "\t" + dUSD, VerticalAlignment.Top, HorizontalAlignment.Right, Color.DarkGreen);
            Chart.DrawStaticText("AUD", "\n\t" + dAUD, VerticalAlignment.Top, HorizontalAlignment.Right, Color.Red);
            Chart.DrawStaticText("CAD", "\n\n\t" + dCAD, VerticalAlignment.Top, HorizontalAlignment.Right, Color.Blue);
            Chart.DrawStaticText("NZD", "\n\n\n\t" + dNZD, VerticalAlignment.Top, HorizontalAlignment.Right, Color.Brown);
            Chart.DrawStaticText("CHF", "\n\n\n\n\t" + dCHF, VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
            Chart.DrawStaticText("EUR", "\n\n\n\n\n\t" + dEUR, VerticalAlignment.Top, HorizontalAlignment.Right, Color.GreenYellow);
            Chart.DrawStaticText("GBP", "\n\n\n\n\n\n\t" + dGBP, VerticalAlignment.Top, HorizontalAlignment.Right, Color.Gold);
        }

        private int getResult(MarketSeries Ticker, IndicatorDataSeries result, int index)
        {
            MovingAverage ma = Indicators.SimpleMovingAverage(Ticker.Close, 200);

            int index2 = GetIndexByDate(Ticker, MarketSeries.OpenTime[index]);
            result[index] = ((Ticker.Close[index2] - ma.Result[index2]) / Ticker.Close[index2]) * 100;

            return (int)(((Ticker.Close.LastValue - ma.Result.LastValue) / Ticker.Close.LastValue) * 10000);
        }

        private int GetIndexByDate(MarketSeries series, DateTime time)
        {
            for (int i = series.Close.Count - 1; i >= 0; i--)
                if (time == series.OpenTime[i])
                    return i;
            return -1;
        }
    }
}


4X
4x.dunder

Joined on 15.08.2019

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Currency Strength JPY.algo
  • Rating: 0
  • Installs: 1644
Comments
Log in to add a comment.
SN
snick6176 · 2 years ago

You are right, I outsource many of my projects, for example, blockchain development. I know many people who use outsourcing services https://wow24-7.io/ in all areas. Mainly IT development, customer support, and e-commerce, it is very profitable.

FE
fernatom08 · 2 years ago

This bot is very useful and can make my tasks easier. My bot is currently being outsourced