Replies

VertoTrading
12 Mar 2020, 09:49

RE:

PanagiotisCharalampous said:

Hi VertoTrading,

The fix has been released on Spotware cTrader Beta. It should be rolled out to brokers soon.

Best Regards,

Panagiotis 

Join us on Telegram

 

Hey Panagiotis,

Awesome thankyou so much for keeping us all in the loop! Never going to leave cTrader as it just work so much better than all the others, plus the support here is alot more reliable!

Really appreciate all the work you and your team are doing with this software. Making it FAR superior than others!


@VertoTrading

VertoTrading
12 Mar 2020, 09:41

RE:

PanagiotisCharalampous said:

Hi VertoTrading,

We will reenable support for static parameters in an upcoming update.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

Thanks for the update mate. Really do appreciate it. Do you have an ETA on when this will be released to brokers?


@VertoTrading

VertoTrading
21 Feb 2020, 09:58

RE:

PanagiotisCharalampous said:

Hi all,

Can we have a code sample that reproduces this problem?

Best Regards,

Panagiotis 

Join us on Telegram

 

Have you been able to fix this problem? if it is the static parameters causing the issue then this nees to be fixed!!!!! i need the static paramaters for my cBot to function properly. I am not in a position to re-write over 7000 lines of code for one error that broke my cBot after an update.


@VertoTrading

VertoTrading
07 Feb 2020, 08:23

RE:

PanagiotisCharalampous said:

Hi all,

Can we have a code sample that reproduces this problem?

Best Regards,

Panagiotis 

Join us on Telegram

 

Hey Panagiotis,


#region References being Used
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using HorizontalAlignment = cAlgo.API.HorizontalAlignment;
using LumenWorks.Framework.IO.Csv;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using RestSharp;
using RestSharp.Authenticators;
using Newtonsoft.Json;
using Telegram.Bot;
using Telegram.Bot.Args;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;
#endregion

#region cBot Coding
namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    #region Main Body of cBot
    public class Verto : Robot, ILogger
    {
        #region Parameters
        readonly string cBotName = "Verto News Trader";
        readonly string BotVersion = " v 1.7.5";

        #region License Key
        [Parameter("Licence Key", DefaultValue = "Please Input License Key", Group = "Licence Key")]
        public static string LicenseKey { get; set; }
        //[Parameter("Enable Telegram", DefaultValue = true, Group = "Licence Key")]
        public bool EnableTelegram = true;
        public static string TeleToken = "958414613:AAG8WdNbZjfhNxXHJ7fxiaH2nuTqhwU1Lx4";
        public static string TeleChatID = "0";
        #endregion

        #region News Parameters
        [Parameter("Display News ONLY", DefaultValue = false, Group = "News Parameters")]
        public bool ShowNewsOnly { get; set; }
        [Parameter("Trade Low Event", DefaultValue = false, Group = "News Parameters")]
        public bool ShowLow { get; set; }
        [Parameter("Trade Medium Event", DefaultValue = false, Group = "News Parameters")]
        public bool ShowMedium { get; set; }
        [Parameter("Trade High Event", DefaultValue = true, Group = "News Parameters")]
        public bool ShowHigh { get; set; }
        #endregion

        #region Order Placement
        [Parameter("Placed before Event (s)", DefaultValue = 60, Group = "Order Placement", MinValue = 1)]
        public int SecondsBefore { get; set; }
        [Parameter("Expires(M)", DefaultValue = 25, Group = "Order Placement", MinValue = 1)]
        public int MinutesTimeout { get; set; }
        [Parameter("One Cancels Other", DefaultValue = true, Group = "Order Placement")]
        public bool Oco { get; set; }
        #endregion

        #region Trading Strategy
        [Parameter("Trading Strategy", DefaultValue = "Standard", Group = "Trading Strategy")]
        public TradingStrategy TradingType { get; set; }
        [Parameter("Trading Label", DefaultValue = "XXXXXX", Group = "Trading Strategy")]
        public string Label { get; set; }
        #endregion

        #region Order Settings
        [Parameter("Pips away", DefaultValue = 5, Group = "Order Settings")]
        public int PipsAway { get; set; }
        [Parameter("Take Profit", DefaultValue = 6, Group = "Order Settings")]
        public int TakeProfit { get; set; }
        [Parameter("Stop Loss", DefaultValue = 30, Group = "Order Settings")]
        public int StopLoss { get; set; }
        [Parameter("Lot Size", DefaultValue = 0.01, Group = "Order Settings", MinValue = 0.01, Step = 0.01)]
        public double LotSize { get; set; }
        #endregion

        #region Standard Trading
        [Parameter("Break-Even w/ T.S.", DefaultValue = true, Group = "Standard Trading")]
        public bool BreakEvenStandard { get; set; }
        [Parameter("Trigger (pips)", DefaultValue = 5, Group = "Standard Trading", MinValue = 1)]
        public int BreakEvenPipsStandard { get; set; }
        [Parameter("Above Entry (pips)", DefaultValue = 2, Group = "Standard Trading")]
        public int BreakEvenExtraPipsStandard { get; set; }
        [Parameter("Trade Protection Active", DefaultValue = true, Group = "Standard Trading")]
        public bool StandardTradeProtect { get; set; }
        #endregion

        #region Ratchet Trading
        [Parameter("Break-Even w/ T.S.", DefaultValue = true, Group = "Ratchet Trading")]
        public bool BreakEvenRatchet { get; set; }
        [Parameter("Trigger (pips)", DefaultValue = 5, Group = "Ratchet Trading", MinValue = 1)]
        public int BreakEvenRatchetTrigger { get; set; }
        [Parameter("Above Entry (pips)", DefaultValue = 2, Group = "Ratchet Trading")]
        public int BreakEvenExtraRatchetPips { get; set; }
        [Parameter("Trade Protection Active", DefaultValue = true, Group = "Ratchet Trading")]
        public bool RatchetTradeProtect { get; set; }
        #endregion

        #region Combination Trading
        [Parameter("1st Break-Even w/ T.S.", DefaultValue = true, Group = "Combination Trading")]
        public bool BreakEvenCombination1st { get; set; }
        [Parameter("1st Trigger (pips)", DefaultValue = 5, Group = "Combination Trading", MinValue = 1)]
        public int BreakEvenCombinationTrigger1st { get; set; }
        [Parameter("1st Above Entry (pips)", DefaultValue = 2, Group = "Combination Trading")]
        public int BreakEvenExtraCombinationPips1st { get; set; }
        [Parameter("2nd Break-Even w/ T.S.", DefaultValue = true, Group = "Combination Trading")]
        public bool BreakEvenCombination2nd { get; set; }
        [Parameter("2nd Trigger (pips)", DefaultValue = 5, Group = "Combination Trading", MinValue = 1)]
        public int BreakEvenCombinationTrigger2nd { get; set; }
        [Parameter("2nd Above Entry (pips)", DefaultValue = 2, Group = "Combination Trading")]
        public int BreakEvenExtraCombinationPips2nd { get; set; }
        [Parameter("Trade Protection Active", DefaultValue = true, Group = "Combination Trading")]
        public bool CombinationTradeProtect { get; set; }
        #endregion

        #region MultiTrade Trading
        [Parameter("Partial Close (%)", DefaultValue = 50, Group = "MultiTrade Trading")]
        public double MultiTradeLotClose { get; set; }
        [Parameter("Break-Even w/ T.S.", DefaultValue = true, Group = "MultiTrade Trading")]
        public bool BreakEvenMultiTrade { get; set; }
        [Parameter("Trigger (pips)", DefaultValue = 5, Group = "MultiTrade Trading", MinValue = 1)]
        public int BreakEvenMultiTradeTrigger { get; set; }
        [Parameter("Above Entry (pips)", DefaultValue = 2, Group = "MultiTrade Trading")]
        public int BreakEvenExtraMultiTradePips { get; set; }
        [Parameter("Trade Protection Active", DefaultValue = true, Group = "MultiTrade Trading")]
        public bool MultiTradeTradeProtect { get; set; }
        #endregion

        #region Money Management
        [Parameter("Enabled", DefaultValue = true, Group = "Money Management")]
        public bool RiskManagement { get; set; }
        [Parameter("Risk, %", DefaultValue = 2.5, Group = "Money Management", MinValue = 0)]
        public double Risk { get; set; }
        [Parameter("Risk, $", DefaultValue = 0, Group = "Money Management", MinValue = 0)]
        public double MoneyRisk { get; set; }
        [Parameter("Fixed Balance", DefaultValue = 0, Group = "Money Management", MinValue = 0)]
        public double FixedBalance { get; set; }
        [Parameter("Use $ Instead of %", DefaultValue = false, Group = "Money Management")]
        public bool UseMoneyInsteadOfPercentage { get; set; }
        [Parameter("Use Eq Instead of Bal", DefaultValue = true, Group = "Money Management")]
        public bool UseEquityInsteadOfBalance { get; set; }
        [Parameter("Lot Digits", DefaultValue = 2, Group = "Money Management", MinValue = 0)]
        public int LotDigits { get; set; }
        #endregion

        #region Trend Trading
        [Parameter("Active", DefaultValue = false, Group = "Trend Trading")]
        public bool TrendTrade { get; set; }
        [Parameter("Source", Group = "Trend Trading")]
        public DataSeries Source { get; set; }
        [Parameter("Fast Period", DefaultValue = 6, Group = "Trend Trading")]
        public int FastPeriods { get; set; }
        [Parameter("Medium Period", DefaultValue = 25, Group = "Trend Trading")]
        public int MediumPeriods { get; set; }
        [Parameter("Slow Period", DefaultValue = 50, Group = "Trend Trading")]
        public int SlowPeriods { get; set; }
        #endregion

        #region Dynamic Order Placement
        [Parameter("Active", DefaultValue = false, Group = "Dynamic Order Placement")]
        public bool DynamicOrders { get; set; }
        [Parameter("Bars Index Lookback", DefaultValue = 6, Group = "Dynamic Order Placement")]
        public int Barlookback { get; set; }
        #endregion

        #region Trade Protection
        [Parameter("Trigger (pips)", DefaultValue = 25, Group = "Trade Protection")]
        public int ReversePositionTrigger { get; set; }
        [Parameter("Position Multiplier", DefaultValue = 5, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double ReverseMulti { get; set; }
        [Parameter("Subsenqent Multiplier", DefaultValue = 6, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double ReverseMultiMulti { get; set; }
        [Parameter("Take Profit Multiplier", DefaultValue = 1, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double TPMulti { get; set; }
        [Parameter("Subsequent Multiplier", DefaultValue = 1, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double TPMultiMulti { get; set; }
        [Parameter("Trigger Multiplier", DefaultValue = 1, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double TriggerMulti { get; set; }
        [Parameter("Subsequent Multiplier", DefaultValue = 1, Group = "Trade Protection", MinValue = 1, Step = 1)]
        public double TriggerMultiMulti { get; set; }
        #endregion

        #region Static Parameters
        private static readonly string ConsumerKey = "ck_2e21af78795b8ac4d327b5facb154a6d441a0375";
        private static readonly string SecretKey = "cs_3b1683f65584a822e7298d1efe700ed8ab2759ed";
        public int EventsToDisplay = 1;
        public int check = 0;
        public int downloadcheck = 0;
        public bool ShowPastNews = true;
        public int PastNewsLookback = 0;
        public bool UpdateEvents = true;
        public static string FileWatchPath = Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%"), "Documents/cAlgo/Sources/Robots/News Downloader");
        public static string FileWatchName = "news_archive.csv";
        private SymbolWrapper _symbol;
        private List<NewsItem> _newsItems;
        private List<NewsItem> _upcomingNews = new List<NewsItem>();
        private Dictionary<DateTime, NewsGroup<NewsItem>> _groups;
        private bool first_run = true;
        private NewsItem NI;
        public bool SymbolFilter = true;
        public bool ShowTimeLeftToNews = true;
        public bool ShowTimeLeftToPlaceOrders = true;
        private bool _ordersCreated;
        public string trendmovement = "None";
        private DateTime _triggerTimeInServerTimeZone;
        private readonly bool hasTrailingStop = true;
        private ExponentialMovingAverage fastMa;
        private ExponentialMovingAverage mediumMa;
        private ExponentialMovingAverage slowMa;
        public string Comment { get; set; }
        //static ITelegramBotClient botClient;
        #endregion

        #endregion

}

If you need more, let me know and I can send you it privatelyas i woul rather not have the code made public.


@VertoTrading

VertoTrading
29 Jan 2020, 14:53

RE:

PanagiotisCharalampous said:

Hi VertoTrading,

cTrader currently is built using .Net v4.0. If you use components that use a higher version, you might run into problems. Regarding the new line code you posted, in order to receive messages, you need to give full access rights to the cBot.

Best Regards,

Panagiotis 

Join us on Telegram

Hey Panagiotis,

Well I'll be a monkeys uncle........ the one bit of code I overlooked............

THANKYOU!!!!!!!

Silly me haha. This thread can now be closed.


@VertoTrading

VertoTrading
29 Jan 2020, 13:42

RE:

PanagiotisCharalampous said:

Hi VertoTrading,

The exception is caused by this line of code

var me = botClient.GetMeAsync().Result;

Which version of Telegram.Bot do you use? Do you build your project using .Net 4.0 or do you use a higher version?

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi Panagiotis,

Thanks for the reply. I can see that this line cases the error, however if i try to use this piece of code:

var message = botClient.SendTextMessageAsync(chatId: TeleChatID, text: "The cBot has Started.", parseMode: ParseMode.Markdown, disableNotification: false);

It does not send the message to the chat group. I have tested the Token and Chat ID to make sure they were correct in Postman and it workded there.

I am running it on .Net 4.5. Do I need to run it on 4.0?


@VertoTrading

VertoTrading
29 Jan 2020, 12:22

RE:

PanagiotisCharalampous said:

Hi VertoTrading,

Can you provide more information? What do you mean when you say the cBot immediately crashes? Do you get any messages in the log? Can you share the cBot code?

Best Regards,

Panagiotis 

Join us on Telegram

 

Hey Panagiotis,

The only error is get is:

Crashed in OnStart with AggregateException: One or more errors occurred.

The cBot code is as follows:

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using Telegram.Bot;
using Telegram.Bot.Args;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ALGOTRADING : Robot
    {
        #region Parameters

        #region Telegram Settings
        [Parameter("Token", DefaultValue = "Place Token Here", Group = "Telegram Settings")]
        public string TeleToken = "958414613:AAG8WdNbZjfhNxXHJ7fxiaH2nuTqhwU1Lx4";
        [Parameter("ChatID", DefaultValue = "Place ChatID Here", Group = "Telegram Settings")]
        public string TeleChatID = "590030638";
        #endregion

        #region Look at Times
        [Parameter("Hour (UTC)", Group = "Telegram Messaging Time", DefaultValue = 21)]
        public int Hours { get; set; }
        [Parameter("Minute(UTC)", Group = "Telegram Messaging Time", DefaultValue = 45)]
        public int Minutes { get; set; }

        #endregion

        #region Order Settings
        [Parameter("Take Profit", DefaultValue = 6, Group = "Order Settings")]
        public int TakeProfit { get; set; }
        [Parameter("Stop Loss", DefaultValue = 30, Group = "Order Settings")]
        public int StopLoss { get; set; }
        [Parameter("Lot Size", DefaultValue = 0.01, Group = "Order Settings", MinValue = 0.01, Step = 0.01)]
        public double LotSize { get; set; }
        #endregion

        #region Ease Of Movement Settings
        [Parameter("Period", Group = "Ease Of Movement Settings", DefaultValue = 14)]
        public int EOMPeriod { get; set; }
        [Parameter("MA Type", Group = "Ease Of Movement Settings", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType EOMType { get; set; }
        private EaseOfMovement eom;
        #endregion

        #region Chaikin Money Flow Settings
        [Parameter("Period", Group = "Chaikin Money Flow Settings", DefaultValue = 14)]
        public int CMFPeriod { get; set; }
        private ChaikinMoneyFlow cmf;
        #endregion

        #region Abolute Strength Settings
        [Parameter("Period", Group = "Abolute Strength Settings", DefaultValue = 14)]
        public int ASPeriod { get; set; }
        [Parameter("Smoothing", Group = "Abolute Strength Settings", DefaultValue = 4)]
        public int ASSmoothing { get; set; }
        [Parameter("Mode", Group = "Abolute Strength Settings", DefaultValue = 1)]
        public int ASMode { get; set; }
        private AbsoluteStrength abs;
        #endregion

        #region Force Index Settings
        public bool shape = true;
        [Parameter("Period", Group = "Force Index Settings", DefaultValue = 14)]
        public int FIPeriod { get; set; }
        private ForceIndex fi;
        #endregion

        #region SSL Settings
        [Parameter("Period", Group = "SSL Settings", DefaultValue = 14)]
        public int SSLPeriod { get; set; }
        [Parameter("Lookback", Group = "SSL Settings", DefaultValue = 1)]
        public int SSLLookback { get; set; }
        private SSL ssl;
        #endregion

        #region Heiken Ashi Settings
        [Parameter("Candle width", Group = "Heiken Ashi Settings", DefaultValue = 5)]
        public int CandleWidth { get; set; }
        [Parameter("Up color", Group = "Heiken Ashi Settings", DefaultValue = "Blue")]
        public string UpColor { get; set; }
        [Parameter("Down color", Group = "Heiken Ashi Settings", DefaultValue = "Red")]
        public string DownColor { get; set; }
        private HeikenAshi ha;
        #endregion

        #region Pips ATR Settings
        [Parameter("Atr TimeFrame", Group = "ATR Settings")]
        public TimeFrame AtrTimeFrame { get; set; }
        [Parameter("ATR Period", Group = "ATR Settings", DefaultValue = 14)]
        public int AtrPeriod { get; set; }
        [Parameter("ATR MAType", Group = "ATR Settings")]
        public MovingAverageType AtrMaType { get; set; }
        private PipsATRIndicator atrpip;

        #endregion

        #region Money Management
        [Parameter("Enabled", DefaultValue = true, Group = "Money Management")]
        public bool RiskManagement { get; set; }
        [Parameter("Risk, %", DefaultValue = 2.5, Group = "Money Management", MinValue = 0)]
        public double Risk { get; set; }
        [Parameter("Risk, $", DefaultValue = 0, Group = "Money Management", MinValue = 0)]
        public double MoneyRisk { get; set; }
        [Parameter("Fixed Balance", DefaultValue = 0, Group = "Money Management", MinValue = 0)]
        public double FixedBalance { get; set; }
        [Parameter("Use $ Instead of %", DefaultValue = false, Group = "Money Management")]
        public bool UseMoneyInsteadOfPercentage { get; set; }
        [Parameter("Use Eq Instead of Bal", DefaultValue = true, Group = "Money Management")]
        public bool UseEquityInsteadOfBalance { get; set; }
        [Parameter("Lot Digits", DefaultValue = 2, Group = "Money Management", MinValue = 0)]
        public int LotDigits { get; set; }
        #endregion

        #region Static Parameters
        public static string eom_movement;
        public static string cmf_movement;
        public static string abs_movement;
        public static string fi_movement;
        public static string ssl_movement;
        public bool _ordersactive;
        #endregion

        #endregion

        protected override void OnStart()
        {
            // Put your initialization logic here
            Timer.Start(1);
            Positions.Opened += OnPositionsOpened;
            Positions.Closed += OnPositionsClosed;
            eom = Indicators.EaseOfMovement(EOMPeriod, EOMType);
            cmf = Indicators.ChaikinMoneyFlow(CMFPeriod);
            abs = Indicators.GetIndicator<AbsoluteStrength>(ASPeriod, ASSmoothing, ASMode);
            fi = Indicators.GetIndicator<ForceIndex>(shape, FIPeriod);
            ssl = Indicators.GetIndicator<SSL>(SSLPeriod);
            ha = Indicators.GetIndicator<HeikenAshi>(CandleWidth, UpColor, DownColor);
            atrpip = Indicators.GetIndicator<PipsATRIndicator>(AtrTimeFrame, AtrPeriod, AtrMaType);
            var botClient = new TelegramBotClient(TeleToken);
            var me = botClient.GetMeAsync().Result;
            Console.WriteLine("Hello, World! I am user {me.Id} and my name is {me.FirstName}.");
        }
        protected override void OnTick()
        {

            // Put your core logic here
            if (eom.Result.IsRising())
            {
                eom_movement = "RISING";
            }
            else if (eom.Result.IsFalling())
            {
                eom_movement = "FALLING";
            }

            if (cmf.Result.IsRising())
            {
                cmf_movement = "RISING";
            }
            else if (cmf.Result.IsFalling())
            {
                cmf_movement = "FALLING";
            }

            if (abs.BullsSma.LastValue > abs.BearsSma.LastValue)
            {
                abs_movement = "Bullish";
            }
            else if (abs.BullsSma.LastValue < abs.BearsSma.LastValue)
            {
                abs_movement = "Bearish";
            }

            if (fi.FI_Line.IsRising())
            {
                fi_movement = "RISING";
            }
            else if (fi.FI_Line.IsFalling())
            {
                fi_movement = "FALLING";
            }

            if (ssl.sslUp.HasCrossedAbove(ssl.sslDown, SSLLookback) || ssl.sslUp.HasCrossedBelow(ssl.sslDown, SSLLookback))
            {
                ssl_movement = " HAS CROSSED";
            }
            else
            {
                ssl_movement = " REMAINS UNCHANGED";
            }
            Chart.DrawStaticText("Ease Of Movement", "Ease Of Movement is " + eom.Result.LastValue + " & is " + eom_movement, VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
            Chart.DrawStaticText("Chaikin Money Flow", "\nChaikin Money Flow is " + cmf.Result.LastValue + " & is " + cmf_movement, VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
            Chart.DrawStaticText("Absolute Strength", "\n\nAbsolute Strength is " + abs_movement, VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
            Chart.DrawStaticText("Force Index", "\n\n\nForce Index is " + fi.FI_Line.LastValue + " & is " + fi_movement, VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
            Chart.DrawStaticText("SSL", "\n\n\n\nSSL" + ssl_movement, VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);

        }

        protected override void OnTimer()
        {
            //put Timer logic here
            var symbol = Symbol.Name;
            Chart.DrawStaticText("Time", "Time is " + Server.TimeInUtc, VerticalAlignment.Top, HorizontalAlignment.Left, Color.AliceBlue);
            var DayOfWeek = Server.TimeInUtc;
            var TimeOfDay = Server.TimeInUtc;

            if (_ordersactive == false)
            {
                if (TimeOfDay.TimeOfDay.Hours == Hours && TimeOfDay.TimeOfDay.Minutes == Minutes && TimeOfDay.TimeOfDay.Seconds == 0)
                {
                    Print("Passed Checkpoint 1");
                    if (eom.Result.LastValue > 0 && cmf.Result.LastValue > 0 && fi.FI_Line.LastValue > 0)
                    {
                        Print("BUY Passed Checkpoint 2");
                        if (ssl.sslUp.HasCrossedAbove(ssl.sslDown, SSLLookback) || ssl.sslUp.HasCrossedBelow(ssl.sslDown, SSLLookback))
                        {
                            Print("BUY Passed Checkpoint 3");
                            if (abs.BullsSma.LastValue > abs.BearsSma.LastValue)
                            {
                                Print("BUY Passed Checkpoint 4");
                                ExecuteMarketOrder(TradeType.Buy, Symbol.Name, Symbol.QuantityToVolumeInUnits(LotsOptimized()), null, (atrpip.Result.LastValue * 1.5), atrpip.Result.LastValue);
                                _ordersactive = true;
                            }
                        }
                    }
                    else if (eom.Result.LastValue < 0 && cmf.Result.LastValue < 0 && fi.FI_Line.LastValue < 0)
                    {
                        Print("SELL Passed Checkpoint 2");
                        if (ssl.sslUp.HasCrossedAbove(ssl.sslDown, SSLLookback) || ssl.sslUp.HasCrossedBelow(ssl.sslDown, SSLLookback))
                        {
                            Print("SELL Passed Checkpoint 3");
                            if (abs.BullsSma.LastValue < abs.BearsSma.LastValue)
                            {
                                Print("SELL Passed Checkpoint 4");
                                ExecuteMarketOrder(TradeType.Sell, Symbol.Name, Symbol.QuantityToVolumeInUnits(LotsOptimized()), null, (atrpip.Result.LastValue * 1.5), atrpip.Result.LastValue);
                                _ordersactive = true;
                            }
                        }
                    }
                }
            }
        }

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

        protected void OnPositionsOpened(PositionOpenedEventArgs args)
        {
            _ordersactive = true;
        }

        protected void OnPositionsClosed(PositionClosedEventArgs args)
        {
            _ordersactive = false;
        }

        #region Money Management

        double LotsOptimized()
        {
            if (!RiskManagement)
                return (LotSize);

            double Size, RiskMoney, PositionSize = 0;

            if (Account.Currency == "")
                return (0);

            if (FixedBalance > 0)
            {
                Size = FixedBalance;
            }
            else if (UseEquityInsteadOfBalance)
            {
                Size = Account.Equity;
            }
            else
            {
                Size = Account.Balance;
            }

            if (!UseMoneyInsteadOfPercentage)
                RiskMoney = Size * Risk / 100;
            else
                RiskMoney = MoneyRisk;

            double UnitCost = Symbol.PipValue;

            if ((StopLoss != 0) && (UnitCost != 0))
                PositionSize = Math.Round(Symbol.VolumeInUnitsToQuantity((int)Math.Round(RiskMoney / StopLoss / UnitCost)), LotDigits);

            //Print(PositionSize);

            if (PositionSize < Symbol.VolumeInUnitsToQuantity(Symbol.VolumeInUnitsMin))
            {
                //Print("Calculated position size (" + PositionSize + ") is less than minimum position size (" + Symbol.VolumeInUnitsToQuantity(Symbol.VolumeInUnitsMin) + "). Setting position size to minimum.");
                PositionSize = Symbol.VolumeInUnitsToQuantity(Symbol.VolumeInUnitsMin);
            }
            else if (PositionSize > Symbol.VolumeInUnitsToQuantity(Symbol.VolumeInUnitsMax))
            {
                //Print("Calculated position size (" + PositionSize + ") is greater than maximum position size (" + Symbol.VolumeInUnitsToQuantity(Symbol.VolumeInUnitsMax) + "). Setting position size to maximum.");
                PositionSize = Symbol.VolumeInUnitsToQuantity(Symbol.VolumeInUnitsMax);
            }

            double LotStep = Symbol.VolumeInUnitsToQuantity(Symbol.VolumeInUnitsStep);
            double steps = PositionSize / LotStep;
            if (Math.Floor(steps) < steps)
            {
                //Print("Calculated position size (" + PositionSize + ") uses uneven step size. Allowed step size = " + LotStep + ". Setting position size to " + (Math.Floor(steps) * LotStep) + ".");
                PositionSize = Math.Floor(steps) * LotStep;
            }

            return (PositionSize);
        }
        #endregion

    }
}

It does reference other indicators i have, however, i removed these references and it still is posing and issue.


@VertoTrading

VertoTrading
16 Aug 2019, 17:28

Never mind i got it sorted. Didn't read the API Refernce properly and i had it reading a lot not a volume value.


@VertoTrading

VertoTrading
27 Jun 2019, 16:16

Hi There,

 

Is there any possibility of being able to have a cBot access the news events?

 

For example, place orders before orders and filter the news events based on their importance?


@VertoTrading

VertoTrading
06 Dec 2018, 04:01

RE:

Panagiotis Charalampous said:

Ηi sean.n.long,

Please post the code so that we can have a look.

Best Regards,

Panagiotis

private void SetBreakEvenAdjustment()
        {
            var allPositions = Positions.FindAll(Label + "2", Symbol);
            foreach (Position position in allPositions)
            {
                if (position.StopLoss != null)
                {
                    var entryPrice = position.EntryPrice;
                    var distance = position.TradeType == TradeType.Buy ? Symbol.Bid - entryPrice : entryPrice - Symbol.Ask;

                    // move stop loss to break even plus and additional (x) pips
                    if (distance >= BreakEvenPips * Symbol.PipSize)
                    {
                        if (position.TradeType == TradeType.Buy)
                        {
                            if (position.StopLoss <= position.EntryPrice + (Symbol.PipSize * BreakEvenExtraPips))
                            {
                                ModifyPosition(position, entryPrice + (Symbol.PipSize * BreakEvenExtraPips), null, hasTrailingStop);
                                Print("Stop Loss to updated set for BUY position {0}", Symbol.Code);
                            }
                        }
                        else
                        {
                            if (position.StopLoss >= position.EntryPrice - (Symbol.PipSize * BreakEvenExtraPips))
                            {
                                ModifyPosition(position, entryPrice - (Symbol.PipSize * BreakEvenExtraPips), null, hasTrailingStop);
                                Print("Stop Loss to updated set for SELL position {0}", Symbol.Code);
                            }
                        }
                    }

                }
            }
        }

Here is the code as requested. it seemed to have stopped working since the last update. I have the 'hasTrailingStop' boolean set to true as well.


@VertoTrading

VertoTrading
01 Dec 2018, 10:28

RE:

Panagiotis Charalampous said:

Hi sean.n.long,

Thanks for the nice comments. I am not sure what you mean with Exponential Moving Average Line. How is this different from the EMA indicator?

Best Regards,

Panagiotis

Just wondering if can now draw the indicator in the chart without having a separate indicator running.For example, i am wanting to draw 4 different ema indicators, but i am wanting my cbot to draw them, not manually put them in myself.


@VertoTrading

VertoTrading
23 Nov 2018, 07:38

Draw EMA Trends in cBot

Hey Guys,

Great Update! Been waiting for this for a while.

Just wondering if it is possible to draw an Exponential Moving Average Line in the cBots now?


@VertoTrading