equivalence iMA, iFractals & iBand in cTrader
13 Feb 2019, 01:23
Hello.
To convert my first indicator from Mt4 i would like to know how to convert iMA, iFractals & iBand
I use it like that in mt4 (wher i is the loop value of the bars...)
val1 = iFractals(NULL, 0, MODE_UPPER, i); MAUP1 = iMA(NULL, 0, MAPeriod, -MoveShift, MODE_SMA, PRICE_HIGH, i); BB_UP = iBands(NULL, 0, BPeriod, Std, 0, PRICE_HIGH, MODE_UPPER, i);
I used http://mq4tocalgo.apphb.com/ to convert and learn the code but it's too complex and a lot of code is not necessary (i think)
Thx for your help
Replies
rooky06
13 Feb 2019, 10:28
I explained myself badly because my English is too poor, so now i use google to translate...
I built an indicator that uses these three indicators. I know these indicators exist in cTrader. I am looking for a code sample to call these indicators to be able to reproduce the indicator that I had created under mt4.
@rooky06
PanagiotisCharalampous
13 Feb 2019, 15:00
Hi rooky06,
See below an example
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewIndicator : Indicator
{
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
private MovingAverage _ma;
private FractalChaosBands _fcb;
private BollingerBands _bb;
protected override void Initialize()
{
_fcb = Indicators.FractalChaosBands(14);
_ma = Indicators.MovingAverage(MarketSeries.Close, 14, MovingAverageType.Simple);
_bb = Indicators.BollingerBands(MarketSeries.Close, 14, 2, MovingAverageType.Simple);
}
public override void Calculate(int index)
{
//Result[index] = ..
}
}
}
Best Regards,
Panagiotis
@PanagiotisCharalampous

PanagiotisCharalampous
13 Feb 2019, 10:21
Hi rooky06,
Why do you need to convert these indicators since they already exist in cTrader? The best option to convert an indicator is to contact a Consultant.
Best Regards,
Panagiotis
@PanagiotisCharalampous