Topics

Forum Topics not found

Replies

cAlgo_Fanatic
22 Apr 2013, 17:11

Fibonacci extensions are available on cTrader web (cT Web) and will be available on cTrader as well. We will consider adding more levels in fibonacci retracement. 


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 16:52

This is an example for local interprocess communication. It demonstrates a communication between a process in cAlgo and another (specific) process running on the same machine. You cannot use it as is to communicate with other applications. 


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 16:37 ( Updated at: 23 Jan 2024, 13:16 )

Please see this sample indicator: [Previous Day High and Low]


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 16:35

Updated

using System;
using cAlgo.API;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true)]
    public class PreviousDayHighLow : Indicator
    {
        private double high = double.MinValue;
        private double low = double.MaxValue;


        [Output("High", Color = Colors.Lime)]
        public IndicatorDataSeries High { get; set; }

        [Output("Low", Color = Colors.Red)]
        public IndicatorDataSeries Low { get; set; }


        public override void Calculate(int index)
        {

            if (TimeFrame == TimeFrame.Daily)
            {
                High[index] = MarketSeries.High[index - 1];
                Low[index] = MarketSeries.Low[index - 1];

                return;
            }

            DateTime currentOpenTime = MarketSeries.OpenTime[index];
            DateTime previousOpenTime = MarketSeries.OpenTime[index - 1];

            bool isNewDay = previousOpenTime.Date != currentOpenTime.Date;
            bool isHighLowInit = Equals(low, double.MaxValue);

            if (isNewDay && !isHighLowInit)
            {
                High[index] = high;
                Low[index] = low;

                low = double.MaxValue;
                high = double.MinValue;
            }
            else
            {
                if (MarketSeries.High[index] > high)
                    high = MarketSeries.High[index];
                if (MarketSeries.Low[index] < low)
                    low = MarketSeries.Low[index];
                
                High[index] = High[index - 1];
                Low[index] = Low[index - 1];
            }
        }

    }
}

 


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 15:21

Please refresh the chart. I am assuming you mean 4/15/2013. 

 


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 12:43

You will have to reference the first indicator in the other (same as with the AverageTrueRange) and the SMA 233 will be set to a value if the condition your are describing is met.

// add the reference to FibGrid7Chart 

// in the global scope before any methods private FibGrid7Chart FibGrid7ChartIndicator;
// inside the for loop that displays the results in the caclulate method
//the 233 SMA to not show on the chart till its is equal to or less than the Upper Band 3 or Lower Band 3 of the Fibonacci Indicator bool condition = _simpleMovingAverage7.Result[index] <= FibGrid7ChartIndicator.Upperband3[index] || _simpleMovingAverage7.Result[index] <= FibGrid7ChartIndicator.LowerBand3.[index] if(condition) Result7[i] = _simpleMovingAverage7.Result[index];




@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 12:21

No, this cannot be changed either.


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 11:49

Trailing stop will be available very soon. In the meantime you may use the sample robot "Sample Trailling Stop" in cAlgo to trail your open positions by supplying the position ID as an input parameter.


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 11:36

It has been fixed. We apologize for the delay.


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 11:27

Yes, we will implement this soon. 


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 11:06

No, the plottype cannot be changed dynamically at the moment. 


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 10:56

This cannot be done at this point because the Mono project did not implement Windows Presentation Foundation APIs.


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 10:48

You would have to split it into two objects. The second object should be padded with spaces to the left so that it does not overlap the first.

 

Also consider using "\t" - tabulation:

ChartObjects.DrawText("text1", "Hello", StaticPosition.TopLeft, Colors.Green);
ChartObjects.DrawText("text2", "\tWorld", StaticPosition.TopLeft, Colors.Yellow);

@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 09:53

    public class NewRobot : Robot
    {
        private bool isTriggered;
        private Position position;
        private double trailingEquity;

        [Parameter(DefaultValue = 50100)]
        public double Target3 { get; set; }

        [Parameter(DefaultValue = 200)]
        public double TrailDistance { get; set; }


        protected override void OnStart()
        {
            Trade.CreateBuyMarketOrder(Symbol, 100000);
        }

        protected override void OnTick()
        {
            if (!isTriggered)
            {
                if (Account.Equity >= Target3)
                {
                    isTriggered = true;
                    trailingEquity = Account.Equity;
                    Print("Triggered at {0}", Account.Equity);
                }
            }
            else
            {
                if (Account.Equity - trailingEquity >= TrailDistance)
                {
                    trailingEquity = Account.Equity;
                    Print("Trailing Equity {0}", trailingEquity);
                }
                else if (Account.Equity - trailingEquity <= -TrailDistance)
                {
                    Print("Retraced equity = {0}", Account.Equity);
                    Trade.Close(position);
                }
            }
        }

        protected override void OnPositionOpened(Position openedPosition)
        {
            position = openedPosition;
        }

        protected override void OnPositionClosed(Position closedPosition)
        {
            Stop();
        }
    }

 


@cAlgo_Fanatic

cAlgo_Fanatic
22 Apr 2013, 09:43

OnPositionOpened is triggered when the pending order is filled. Positions do represent market orders. Do you need help with the code to do hedging?


@cAlgo_Fanatic

cAlgo_Fanatic
19 Apr 2013, 18:04 ( Updated at: 21 Dec 2023, 09:20 )

Please show us an example of your results.

These are the results in our backtesting:


@cAlgo_Fanatic

cAlgo_Fanatic
19 Apr 2013, 14:31

This is merely a visualization of the market depth. It is identical for all timeframes.


@cAlgo_Fanatic

cAlgo_Fanatic
19 Apr 2013, 12:00

Are the performance issues you are reporting being experienced on both cTrader and cTrader Web or only cTrader? There are performance optimizations that we are working on and these problems will be fixed soon. As far as the connection problem is concerned, it may also be related to your internet speed. Please make sure that you are connected to the internet at all times and let us know if the probem persists.


@cAlgo_Fanatic

cAlgo_Fanatic
19 Apr 2013, 11:56

This issue is fixed now. Could you please check again? 


@cAlgo_Fanatic

cAlgo_Fanatic
18 Apr 2013, 10:07

System.IO.Pipes is included in cAlgo. We will add a sample in this section: /forum/calgo-reference-samples.


@cAlgo_Fanatic