Limit Order trail by Moving Average

Created at 19 Jan 2018, 17:45
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!
FO

fostex

Joined 19.01.2018

Limit Order trail by Moving Average
19 Jan 2018, 17:45


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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter]
public DataSeries Source { get; set; }
 
[Parameter(DefaultValue = 14)]
public int Period { get; set; }

private SimpleMovingAverage _ma
_ma = Indicators.SimpleMovingAverage(Source, Period);;

double newPrice  = _ma;

if(TradeType.Buy)
 newPrice = (_ma + 30*Symbol.PipsSize)
if(TradeType.Sell)
newPrice = (_ma - 30*Symbol.PipsSize)

ModifyPendingOrder(newPrice)
    }
}
}

Hello and sorry for my eng. I need cBot for trailing my pending limit orders every 30 minut by Moving Average. cBot not working, please help ! )


@fostex