WilliamsAccumulationDistribution tendency curve

Created at 27 Apr 2020, 00:24
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
EL

eliezer_barros

Joined 21.12.2018

WilliamsAccumulationDistribution tendency curve
27 Apr 2020, 00:24


Hi,

I created the routine below and I wish that robot drawing the tendency curve for specific period, for example for the last 5 hours before 11AM. Someone can help me?

Tks

 

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.IO;
using System.Text;
namespace cAlgo.Robots
{


    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Rotinacomcorrecaodecurvas : Robot
    {
        [Parameter(DefaultValue = 1)]
        public double VolumeToOpenOrders { get; set; }

        [Parameter(DefaultValue = 30)]
        public int TakeProfitInPips { get; set; }

        [Parameter("Stop Loss", DefaultValue = 27)]
        public int StopLoss { get; set; }

        [Parameter("Hora Abertura   H", DefaultValue = 11)]
        public int LastValue { get; set; }

        [Parameter("Correção Curva", DefaultValue = 13.0)]
        public int Parameter { get; set; }

        protected override void OnBar()
        {
            if (Bars.OpenTimes.LastValue.Hour == LastValue)
            {
                var sma = Indicators.WilliamsAccumulationDistribution();
                Print("SMA", LastValue);
                {
                    if (sma.Result.LastValue > sma.Result.Last(Parameter))
                        ExecuteMarketOrder(TradeType.Buy, Symbol.Name, VolumeToOpenOrders, "", StopLoss, TakeProfitInPips);
                }
                {
                    if (sma.Result.LastValue < sma.Result.Last(Parameter))
                        ExecuteMarketOrder(TradeType.Sell, Symbol.Name, VolumeToOpenOrders, "", StopLoss, TakeProfitInPips);
                    {
                    }
                }

            }
        }
    }
}


@eliezer_barros
Replies

PanagiotisCharalampous
27 Apr 2020, 10:54

Hi Eliezer,

I did not understand what do you need. Can you please provide a more detailed explanation? Maybe a drawing depicting what you expect to see?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

eliezer_barros
27 Apr 2020, 17:00

RE: WilliamsAccumulationDistribution tendency curve

PanagiotisCharalampous said:

Hi Eliezer,

I did not understand what do you need. Can you please provide a more detailed explanation? Maybe a drawing depicting what you expect to see?

Best Regards,

Panagiotis 

Join us on Telegram

Hi

Please see the example below, I took a part of the curve and you can see that is impossible to determine the correct direction of this curve to open the new position.

I want that this routine pick last 5 hours, determine the direction (tendency line if up or down) and create a new position according.

tks

 

 


@eliezer_barros

eliezer_barros
28 Apr 2020, 21:00 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE: WilliamsAccumulationDistribution tendency curve

eliezer_barros said:

PanagiotisCharalampous said:

Hi Eliezer,

I did not understand what do you need. Can you please provide a more detailed explanation? Maybe a drawing depicting what you expect to see?

Best Regards,

Panagiotis 

Join us on Telegram

Hi

Please see the example below, I took a part of the curve and you can see that is impossible to determine the correct direction of this curve to open the new position.

I want that this routine pick last 5 hours, determine the direction of the tendency line if up or down and create a new position according.

May you help me?

tks

 

 


@eliezer_barros

PanagiotisCharalampous
29 Apr 2020, 08:27

Hi Eliezer,

Only you know what the tendency curve is and how it is calculated. Therefore you will need to calculate it yourself.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

eliezer_barros
29 Apr 2020, 18:29

RE: WilliamsAccumulationDistribution tendency curve - Linear Regression

PanagiotisCharalampous said:

Hi Eliezer,

Only you know what the tendency curve is and how it is calculated. Therefore you will need to calculate it yourself.

Best Regards,

Panagiotis 

Join us on Telegram

Hi,

You is correct, I should have sent additional information, I am trying to use Linear Regression over the Williams Accumulator Distribution.

The routine should be indicate which hours I should be open the position and the direction (buy or sell) is dependent of Linear Regression results.

I appreciate is you could be help.

Tks


@eliezer_barros