Topics
22 Apr 2016, 18:52
 21
 1133
 1
19 Apr 2016, 20:00
 4650
 5
Replies

Stokes Bay
02 May 2018, 20:27 ( Updated at: 02 May 2018, 20:32 )

oh i see


@Stokes Bay

Stokes Bay
02 May 2018, 20:25

Hi,

I love the platform and have used MT4 and broker own platforms (saxo,IB,IG - ive done them all by now!!). Im currently with ICMarkets and have used others with no complaints eg Pepperstone. The broker is only relevant in terms of leverage, account currency, type, regulation, etc that you want.

You shouldnt really notice any difference with any broker in terms of trading since its all NDD/ECN ie the broker is not involved with your trade execution.


@Stokes Bay

Stokes Bay
08 Jan 2018, 18:53

here is the answer below for those interested:

 

// -------
// PURPOSE
// -------
// Alerts user when there is high volatility in the market over a period of seconds.
// Userful signal when not looking at charts or when not at computer, configurable audible sound alerts for each currency.
// Good for scalping.

// Author: Paul Hayes    
// Date:   24/12/2015
// Version 1.5
//
// Coding Guidlines: https://github.com/dotnet/corefx/wiki/Framework-Design-Guidelines-Digest
//
// Bug fix: display formatting issue.

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ScalpersBuddy : Indicator
    {
        #region user defined parameters

        [Parameter("Alert ON", DefaultValue = true)]
        public bool AlertOn { get; set; }

        [Parameter("Sound ON", DefaultValue = true)]
        public bool PlaySound { get; set; }

        [Parameter("Volatility Pips", DefaultValue = 10, MaxValue = 200000, MinValue = 1)]
        public int VolatilityPips { get; set; }

        [Parameter("Media File", DefaultValue = "c:\\windows\\media\\notify.wav")]
        public string MediaFile { get; set; }

        [Parameter("Display Position, 1-8", DefaultValue = 2, MinValue = 1, MaxValue = 3)]
        public int WarningPostion { get; set; }

        [Parameter("Warning Color", DefaultValue = "Red")]
        public string WarningColor { get; set; }

        [Parameter("Show Volatility", DefaultValue = true)]
        public bool ShowVolatility { get; set; }

        [Parameter("Show Spread", DefaultValue = true)]
        public bool ShowSpread { get; set; }

        [Parameter("Show Depth of Market", DefaultValue = true)]
        public bool ShowDepthOfMarket { get; set; }

        [Parameter("Spread Color", DefaultValue = "White")]
        public string SpreadColor { get; set; }

        #endregion

        #region Private properties

        private MarketSeries mSeries;
        private StaticPosition position;
        private Colors warningTextColor;
        private Colors spreadTextColor;
        private bool errorOccured = false;
        private string lowerPosition = string.Empty;
        private MarketDepth marketDepth;

        #endregion

        const string errorMsg = "\n\n\n\n\n Scalpers Buddy Indicator: An error has occurred, view log events window for more information.";


        #region cTrader Events

        protected override void Initialize()
        {
            try
            {
                // Get the time-frame series of data
                mSeries = MarketData.GetSeries(Symbol, TimeFrame.Minute);
                warningTextColor = (Colors)Enum.Parse(typeof(Colors), WarningColor, true);
                spreadTextColor = (Colors)Enum.Parse(typeof(Colors), SpreadColor, true);

                if (ShowDepthOfMarket)
                {
                    //  Get Market Depth
                    marketDepth = MarketData.GetMarketDepth(Symbol);

                    // subscribe to event Updated
                    marketDepth.Updated += MarketDepthUpdated;
                }

            } catch (Exception e)
            {
                errorOccured = true;
                Print("Scalpers Buddy: " + e.Message);
            }

            // position alert message on screen
            switch (WarningPostion)
            {
                case 1:
                    position = StaticPosition.TopLeft;
                    break;
                case 2:
                    position = StaticPosition.TopCenter;
                    break;
                case 3:
                    position = StaticPosition.TopRight;
                    break;
                case 4:
                    position = StaticPosition.Right;
                    lowerPosition = "\n\n";
                    break;
                case 5:
                    position = StaticPosition.BottomRight;
                    lowerPosition = "\n\n";
                    break;
                case 6:
                    position = StaticPosition.BottomCenter;
                    lowerPosition = "\n\n";
                    break;
                case 7:
                    position = StaticPosition.BottomLeft;
                    lowerPosition = "\n\n";
                    break;
                case 8:
                    position = StaticPosition.Left;
                    lowerPosition = "\n\n";
                    break;
                default:
                    position = StaticPosition.TopLeft;
                    break;
            }
        }

        public override void Calculate(int index)
        {
            if (errorOccured)
            {
                ChartObjects.DrawText("error-label", errorMsg, StaticPosition.TopCenter, Colors.Red);
                return;
            }

            // get the last highest price value
            double high = (mSeries.High.LastValue);
            // get the last lowest price value
            double low = (mSeries.Low.LastValue);

            // difference between high and low divided by the current instruments pip size = sudden movement in pips
            double pips = (high - low) / Symbol.PipSize;

            string pipsVolatility = "(Bar h-l: " + pips.ToString("0.00") + " pips)";

            // display error message to screen.
            if (ShowVolatility)
            {
                ChartObjects.DrawText("volatilityMsg", pipsVolatility += lowerPosition, position, spreadTextColor);
            }

            // if pip movement > volatility setting 
            if (Math.Ceiling(pips) > VolatilityPips)
            {
                if (AlertOn)
                {
                    ChartObjects.DrawText("alertMsg", pipsVolatility, position, warningTextColor);
                    Notifications.SendEmail("xxx@hotmail.com", "xxx@gmail.com", Symbol.Code + " Volatility trigger hit", "Volatility trigger hit");
                }

                if (PlaySound)
                {
                    if (MediaFile != string.Empty)
                        Notifications.PlaySound(MediaFile);
                }
            }
            else
            {
                ChartObjects.RemoveObject("alertMsg");
            }

            // if user wants to see the current bid/ask spread size, * feature separate from volatility alert.
            if (ShowSpread)
            {
                var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
                string s = string.Format("{0:N2}", spread);

                ChartObjects.DrawText("spreadMsg", "\nSpread: " + s, position, spreadTextColor);
            }
        }

        #endregion

        #region market depth

        private void MarketDepthUpdated()
        {
            double bidVolume = 0;
            double askVolume = 0;

            foreach (var entry in marketDepth.BidEntries)
            {
                double dVolume = Math.Round(entry.Volume / 1000000.0, 2);
                bidVolume += dVolume;
            }

            foreach (var entry in marketDepth.AskEntries)
            {
                double dVolume = Math.Round(entry.Volume / 1000000.0, 2);
                askVolume += dVolume;
            }


        }

        #endregion
    }
}

 


@Stokes Bay

Stokes Bay
28 Dec 2017, 11:36

I thought you could use a demo account to follow a strategy? Following a strategy with real money without doing you own due diligence is not a good idea.

There is information on number of current followers and money following, real and demo, on each strategy so I would take that as a good guide.

A feedback button is open to misuse and awfully subjective. 

It is a case of: buyer beware.


@Stokes Bay

Stokes Bay
12 Dec 2017, 16:08

Does each trade not have a trade number to which you can refer? 

Or, positions held, account balance, etc will change when a trade is closed, could you use that?

Sorry, I don't know the calgo language.


@Stokes Bay

Stokes Bay
29 Nov 2017, 12:05

Perfect. Many thanks.


@Stokes Bay

Stokes Bay
26 Sep 2017, 16:00

Thanks. I actually don't know how to code which was more the issue. But I adapted the ctrader standard 'Advanced take profit' algo and it works fine.

Amended code below for anyone that wants it.

My only issue with this is the chart does not show the TP lines. Anyone know how to show the these on the chart? Maybe it is due to the orders not being active unless the bar closes and hence the orders are not active unless it is the close of the bar.

 

// -------------------------------------------------------------------------------------------------
//
//    This code is a cAlgo API sample.
//
//    This cBot is intended to be used as a sample and does not guarantee any particular outcome or
//    profit of any kind. Use it at your own risk
//
// -------------------------------------------------------------------------------------------------

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class PCtakeprofitonbarclose : Robot
    {
        private const string DefaultPositionIdParameterValue = "PID";

        [Parameter("Position Id", DefaultValue = DefaultPositionIdParameterValue)]
        public string PositionId { get; set; }

        [Parameter("Take Profit 1 Enabled", DefaultValue = false)]
        public bool TakeProfit1Enabled { get; set; }

        [Parameter("Take Profit 1 Pips", DefaultValue = 10)]
        public double TakeProfit1Pips { get; set; }

        [Parameter("Take Profit 1 Volume", DefaultValue = 1000)]
        public int TakeProfit1Volume { get; set; }

        [Parameter("Take Profit 2 Enabled", DefaultValue = false)]
        public bool TakeProfit2Enabled { get; set; }

        [Parameter("Take Profit 2 Pips", DefaultValue = 20)]
        public double TakeProfit2Pips { get; set; }

        [Parameter("Take Profit 2 Volume", DefaultValue = 2000)]
        public int TakeProfit2Volume { get; set; }

        [Parameter("Take Profit 3 Enabled", DefaultValue = false)]
        public bool TakeProfit3Enabled { get; set; }

        [Parameter("Take Profit 3 Pips", DefaultValue = 10)]
        public double TakeProfit3Pips { get; set; }

        [Parameter("Take Profit 3 Volume", DefaultValue = 3000)]
        public int TakeProfit3Volume { get; set; }

        private TakeProfitLevel[] _levels;

        private Symbol _symbol;

        protected override void OnStart()
        {
            if (PositionId == DefaultPositionIdParameterValue)
                PrintErrorAndStop("You have to specify \"Position Id\" in cBot Parameters");

            var position = FindPositionOrStop();
            _symbol = GetSymbol(position);
            _levels = GetTakeProfitLevels();

            ValidateLevels(position);
        }

        private Symbol GetSymbol(Position position)
        {
            return MarketData.GetSymbol(position.SymbolCode);
        }

        private void ValidateLevels(Position position)
        {
            MakeSureAnyLevelEnabled();
            ValidateTotalVolume(position);
            ValidateReachedLevels(position);
            ValidateVolumes();
        }

        private void ValidateVolumes()
        {
            var enabledLevels = _levels.Where(level => level.IsEnabled);
            foreach (var level in enabledLevels)
            {
                if (level.Volume < _symbol.VolumeMin)
                    PrintErrorAndStop("Volume for " + _symbol.Code + " cannot be less than " + _symbol.VolumeMin);
                if (level.Volume > _symbol.VolumeMax)
                    PrintErrorAndStop("Volume for " + _symbol.Code + " cannot be greater than " + _symbol.VolumeMax);
                if (level.Volume % _symbol.VolumeMin != 0)
                    PrintErrorAndStop("Volume " + level.Volume + " is invalid");
            }
        }

        private void ValidateReachedLevels(Position position)
        {
            var reachedLevel = _levels.FirstOrDefault(l => l.Pips <= position.Pips);
            if (reachedLevel != null)
                PrintErrorAndStop("Level " + reachedLevel.Name + " is already reached. The amount of Pips must be more than the amount of Pips that the Position is already gaining");
        }

        private void MakeSureAnyLevelEnabled()
        {
            if (_levels.All(level => !level.IsEnabled))
                PrintErrorAndStop("You have to enable at least one \"Take Profit\" in cBot Parameters");
        }

        private void ValidateTotalVolume(Position position)
        {
            var totalVolume = _levels.Where(level => level.IsEnabled).Sum(level => level.Volume);

            if (totalVolume > position.Volume)
                PrintErrorAndStop("The sum of all Take Profit respective volumes cannot be larger than the Position's volume");
        }

        private TakeProfitLevel[] GetTakeProfitLevels()
        {
            return new[] 
            {
                new TakeProfitLevel("Take Profit 1", TakeProfit1Enabled, TakeProfit1Pips, TakeProfit1Volume),
                new TakeProfitLevel("Take Profit 2", TakeProfit2Enabled, TakeProfit2Pips, TakeProfit2Volume),
                new TakeProfitLevel("Take Profit 3", TakeProfit3Enabled, TakeProfit3Pips, TakeProfit3Volume)
            };
        }

        private Position FindPositionOrStop()
        {
            var position = Positions.FirstOrDefault(p => "PID" + p.Id == PositionId || p.Id.ToString() == PositionId);
            if (position == null)
                PrintErrorAndStop("Position with Id = " + PositionId + " doesn't exist");

            return position;
        }

        private void PrintErrorAndStop(string errorMessage)
        {
            Print(errorMessage);
            Stop();

            throw new Exception(errorMessage);
        }

        protected override void OnBar()
        {
            var position = FindPositionOrStop();
            var reachedLevels = _levels.Where(level => level.IsEnabled && !level.IsTriggered && level.Pips <= position.Pips);

            foreach (var reachedLevel in reachedLevels)
            {
                reachedLevel.MarkAsTriggered();

                Print("Level \"" + reachedLevel.Name + "\" is reached. Level.Pips: " + reachedLevel.Pips + ", Position.Pips: " + position.Pips + ", Position.Id: " + position.Id);
                var volumeToClose = Math.Min(reachedLevel.Volume, position.Volume);
                ClosePosition(position, volumeToClose);

                if (!LastResult.IsSuccessful)
                    Print("Cannot close position, Id: " + position.Id + ", Error: " + LastResult.Error);

                var remainingLevels = _levels.Where(level => level.IsEnabled && !level.IsTriggered);
                if (!remainingLevels.Any())
                {
                    Print("All levels were reached. cBot is stopping...");
                    Stop();
                    return;
                }
            }
        }
    }

    internal class TakeProfitLevel
    {
        public string Name { get; private set; }

        public bool IsEnabled { get; private set; }

        public double Pips { get; private set; }

        public int Volume { get; private set; }

        public bool IsTriggered { get; private set; }

        public TakeProfitLevel(string name, bool isEnabled, double pips, int volume)
        {
            Name = name;
            IsEnabled = isEnabled;
            Pips = pips;
            Volume = volume;
        }

        public void MarkAsTriggered()
        {
            IsTriggered = true;
        }
    }
}

 


@Stokes Bay

Stokes Bay
15 Sep 2016, 20:33

Yep


@Stokes Bay

Stokes Bay
07 Sep 2016, 15:47

RE:

afhacker said:

You can use ForexFactory weekly XML:

http://www.forexfactory.com/ffcal_week_this.xml

It's better option than reading a web page.

Thanks but the XML is only the calendar, it does not include actual release data.


@Stokes Bay

Stokes Bay
07 Sep 2016, 14:11

Just look at how USD traded post the ISM non-man PMI release. Initial move was < 1 second post release then over the next hour it weakened further until coming into 'fair value' area where most market participants were in balance.

Some traders trade milliseconds off the release but others traded slower (maybe they even had a meeting!) but still perceived there was value trading up to an hour later. Obviously varies each time/release.


@Stokes Bay

Stokes Bay
07 Sep 2016, 11:28

Thanks, Rui.

I would be very interested if anyone has any comments on the technical side of this as opposed to the economics.


@Stokes Bay

Stokes Bay
07 Sep 2016, 00:30

No, it's not. I appreciate the speed the market moves on the release. All I need to do is place a trade on me receiving the release. This may be 1-2 seconds post the fastest algo out there but I am not looking to profit from the first couple of seconds but from the next 30 minutes. Clearly the earlier I get in the better but I still perceive opportunity post a few seconds.


@Stokes Bay

Stokes Bay
18 Aug 2016, 22:20

cmirror?


@Stokes Bay

Stokes Bay
18 Aug 2016, 20:48

 It is simply a matter of the bank having the option to reject a trade that came from a taker - no delays are necessary for that.

If the LP is quoting 100-101 and i place an order to buy at 101 then the question about last-look is, with ctrader, does the LP have the option to either deal at 101 or reject.

Given the LP is quoting at that price and receives a buy order at 101 then with no last-look they should be obliged to deal at 101. Having the option, under ctrader, to hold my order (even for 1ms) whilst they look around at other prices being quoted is not being addressed in the Spotware reply above.

Clearly if i place an order after the LP quote was withdrawn or a price inside the spread then the LP should not be obliged to deal. 

Spotware, can you tell me as a trader ("TRADERS FIRST®"), whether LPs have the opportunity to reject orders at a price for which they are quoting into the market.

I will be delighted if the answer is a straight, "No".

 


@Stokes Bay

Stokes Bay
13 Aug 2016, 17:38

that's just how the x2 original position works.

to do as you want (see 2 separate positions) you need to open a new position rather than double the original one


@Stokes Bay

Stokes Bay
12 Aug 2016, 16:11

PLEASE REPLY as you ignored my previous post.  I also noted one other trade, with ICmarkets, had the same issue so maybe this is a ctrader server issue?

the above should say "...one other trader, with ICmarkets"  not one other trade. So i am saying someone else has experienced this issue with ctrader with another broker.


@Stokes Bay

Stokes Bay
10 Aug 2016, 09:59

I had this as well with Pepperstone - see my post below on 5 August.

Spotware - any response please?


@Stokes Bay

Stokes Bay
05 Aug 2016, 16:03

the broker, who have access to the spotware server, just told me they had no drops. 

 

anyone else?

 

i dont think spotware will let me name the broker? not that i think it is their fault


@Stokes Bay

Stokes Bay
03 Aug 2016, 18:14

the possible explanation here is me not checking the force minimum quantity so the partial-close may have generated an close quantity below the 0.01 minimum size. i've updated to force the partial-close at minimum quantity now and will update this post again with the answer once another trade goes through.


@Stokes Bay

Stokes Bay
02 Aug 2016, 17:43

RE:

did the signal provider use partial-closes i wonder? see my earlier forum topic.

i dont think trades closed using partial-closes are mirrored. that was my experience last week.

 

jaycob.bell said:

Hello Spotware Team, 

 

When I opened cmirror today, I had 21 positions still opened but on the signal provider's account it showed all those positions to be closed. Can you comment in general terms why or how this could of happened? Does the server sometimes stop? Believe this is the first time it has happened in 2 months. 

My account was still mirroring the trader, I cant understand why my positions didn't close when the providers signals closed. Do I need a VPS to ensure my trades follow accurately?

Kinds Regards

 

Jaycob Bell

Jaycob.bell@gmail.com

+61 458821046 

 

 


@Stokes Bay