Replies

LSR2412
30 Jan 2015, 12:11

It seems that you have placed orders in wrong order.

If you open position with limit sell, as it was in this case, your stop loss MUST BE ABOVE ENTRY

but you placed it below...so when limit to open sell position is filled...your stop loss is also filled...because where it is placed
 


@LSR2412

LSR2412
15 Jan 2015, 11:53

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class DailyHighandLow : Indicator
    {
        private MarketSeries dailySeries;

        protected override void Initialize()
        {

            dailySeries = MarketData.GetSeries(Symbol, TimeFrame.Daily);
        }

        public override void Calculate(int index)
        {
            ChartObjects.DrawText("Low", "L=  " + MarketSeries.Low.LastValue, StaticPosition.BottomLeft, Colors.Black);

            ChartObjects.DrawText("High", "H= " + MarketSeries.High.LastValue + "\n\n", StaticPosition.BottomLeft, Colors.DarkGray);
        }
    }
}

itaiophir said:

Hi,

Is this solved?

If so, how can it be done?

tnx!

admin said:

Most probably it will be available very soon.

 

 

 

 


@LSR2412

LSR2412
14 Jan 2015, 13:36

I managed to have just number

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ADR : Indicator
    {
        private AverageDailyRange adr;
        [Parameter("Period", DefaultValue = 100)]

        public int Length { get; set; }

        protected override void Initialize()
        {
            adr = Indicators.GetIndicator<AverageDailyRange>(Length);
        }

        public override void Calculate(int index)
        {
            ChartObjects.DrawText("adr", adr.Result.LastValue.ToString(), StaticPosition.TopRight, Colors.Red);
        }
    }
}

this is separate indicator...and for this to work you need to tick on Average Daily Range under manage references...

Basically this indicator is calling Average Daily Range in background, and only showing last value


@LSR2412

LSR2412
13 Jan 2015, 13:11

RE:

If you put this 

ChartObjects.DrawText("adr1", Result.LastValue.ToString(), StaticPosition.BottomRight, Colors.Red);

in line number 26 of Average Daily Range indicator you will get numerical value, but still on bottom part of chart line will be seen with number...my coding knowledge is limited, and I don't know how to remove line drawn. You only can reduce bottom window..maybe this helps to save a bit of space

 

 

kechel said:

Does anybody know if it's possible for the current ADR to show only as a number, say in the top left hand corner of the chart, rather than having to have the graph appear at the bottom taking up more screen space? Thanks

 

 


@LSR2412

LSR2412
08 Jan 2015, 11:38

Print("Daily Pip Range: " + (MarketData.GetSeries(Symbol, TimeFrame.Daily).High[index - 12] - MarketData.GetSeries(Symbol, TimeFrame.Daily).Low[index - 12]) / Symbol.PipSize);

 

you need to replace .LastValue with [index-12] where "index" is last bar ie. current bar, and -12 then looks back 12 periods...


@LSR2412

LSR2412
15 Nov 2014, 17:13

thanks,

I actually wanted to get code of MACD Histogram indicator which is already built in cTrader.

But I managed (newb in coding) to use that built in indicator as reference when I constructed my own MACD Histogram with help of formula above.


@LSR2412

LSR2412
14 Nov 2014, 13:14

Hello,

can I get MACD histogram code please

Thanks


@LSR2412