Replies

anton.kovalchuk
11 Sep 2020, 15:33

RE:

Panagiotis Charalampous Thank you for quick response 

It was not all code

but this small code does not work too

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class InsideBar : Robot
    {
        [Parameter("Positon Value", Group = "Position Settings", DefaultValue = 5000)]
        public double PositionValue { get; set; }


        protected override void OnStart()
        {

            Bars.BarOpened += NewBarOpened;

        }

        public void NewBarOpened(BarOpenedEventArgs br)
        {
            Print("New Bar");
        }


        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Video: https://gofile.io/d/ik0m49


@anton.kovalchuk

anton.kovalchuk
23 Apr 2020, 14:54

RE:

PanagiotisCharalampous said:

Hi Anton,

Assuming you are referring to h1 bars and you are using GMT time, here is an example

            var bars = MarketData.GetBars(TimeFrame.Hour, Symbol.Name);          
            for (int i = 0; i < 24; i++)
            {
                if (bars.OpenTimes.Last(i).Hour == 8)
                    Print(bars.ClosePrices.Last(i));
            }

Best Regards,

Panagiotis 

Join us on Telegram

This is exactly what I need

Thank you a lot PanagiotisCharalampous


@anton.kovalchuk

anton.kovalchuk
29 Mar 2020, 21:37

RE:

PanagiotisCharalampous said:

Hi Leonardo,

Thanks for posting in our forum. Regarding your question, currently this is not possible in cAlgo.

Best Regards,

Panagiotis

 

Was it implemented in cAlgo 3.7?

I'm tring do this and cannot.


@anton.kovalchuk

anton.kovalchuk
31 Aug 2018, 11:57

Gool..!!!!!

Thank you a lot Panagiotis Charalampous

 


@anton.kovalchuk

anton.kovalchuk
26 Apr 2018, 16:09

OK Clear, 

Thank you Panagiotis Charalampous


@anton.kovalchuk

anton.kovalchuk
26 Apr 2018, 15:36

cAlgo 2.01


@anton.kovalchuk

anton.kovalchuk
10 Apr 2018, 15:10

Great, The manual explain all that I need. Thanks!


@anton.kovalchuk

anton.kovalchuk
10 Apr 2018, 13:41 ( Updated at: 21 Dec 2023, 09:20 )

Thank you a lot Panagiotis

To clarify only, so I can use data from indicators that exist in cAlgo\Sources\ catalog only. Correct? 

An indicator that I was going to use does not exist there but exist in standard indicators list. as on my screenshot:


@anton.kovalchuk

anton.kovalchuk
10 Apr 2018, 12:23

Hi Panagiotis Charalampous

Thank you for an answer.

I know about the indicator only.

KeltnerChannels

Summary

Initializes the Keltner Channels indicator instance

Syntax

public KeltnerChannels KeltnerChannels(int maPeriod, MovingAverageType maType, int atrPeriod, MovingAverageType atrMaType, double bandDistance)

Return type

KeltnerChannels

Parameters

Name Description

maPeriod Moving Average Period

maType Moving Average Type

atrPeriod Average True Range Period

atrMaType Average True Range MAType

bandDistance ATR Multiplier
Members
Name	Description
Bottom	Moving Average - ATR * BandDistance
Main	Moving Average Line
Top	Moving Average + ATR * BandDistance

  protected override void OnTick()
        {
            // my cBot should knowns when the current market price will be equal to KeltnerChannels.Main.LastValue

            //and able to close position when current market price will be equal to KeltnerChannels.Bottom.LastValue or Top
        }


@anton.kovalchuk

anton.kovalchuk
27 Mar 2018, 09:43

Hi Panagiotis,

Yes, it works a great.

 

Thanks,

 


@anton.kovalchuk

anton.kovalchuk
26 Mar 2018, 23:48

The example exists in cAlgo confluence. 

var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
if (position != null )
{
    double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
    double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
    ModifyPosition(position, stopLoss,  takeProfit);
}

 

 


@anton.kovalchuk

anton.kovalchuk
26 Mar 2018, 18:22

RE:

Panagiotis Charalampous said:

Hi Anton,

You could try to use a condition like the sample below

           if(DateTime.UtcNow.Hour >= 8 && DateTime.UtcNow.Hour < 4)
           {
           // Do something...
           }

Let me know if this helps,

Best Regards,

Panagiotis

Thank you a lot Panagiotis Charalampous.

 

 


@anton.kovalchuk