Topics
15 Jun 2020, 02:50
 1
 1213
 1
26 Dec 2017, 21:50
 2847
 1
21 Nov 2017, 22:13
 2137
 2
08 Nov 2017, 14:04
 2394
 1
14 Sep 2017, 11:13
 8535
 16
02 Sep 2017, 07:41
 11215
 37
28 Aug 2017, 15:58
 2118
 4
20 Aug 2017, 15:08
 2109
 4
16 Aug 2017, 10:16
 1733
 2
09 Aug 2017, 14:28
 8345
 21
Replies

HTtrader
04 Jan 2018, 12:51

Hi itmfar,

I have an idea on how I am going to go about this, how much programming and knowledge of neural netoworks do you have? If you can understand this we might be able to collaborate on this. I plan to have 4 input neurons high low open and close with 3 output bull bear neutral and at this stage plan to back propogate the learning.

Regards,

Tony


@HTtrader

HTtrader
26 Dec 2017, 21:58

Thanks Andrey,

I thought it was a line of code that triggered the event. That poses 2 questions after my testing

1. Has spotware provided a solution or update to this bug?

2. Is there a way to code delete duplicate orders?

Surprisingly after my tests the code runs through twice on the first onbar event but then subsequent onbar only runs once, is this an anomaly or something else?

I have my code working the way I want it to so these are just nice to know and have maybe for the next version.

Thanks,

Tony


@HTtrader

HTtrader
21 Oct 2017, 01:15

Hi Panagiotis,

I have now resolved this issue. I have been chopping and changing between different coding languages as at work I am using vba and ladder logic and sometimes it gets lost in translation. The reason I am asking all these questions is because I am finding that calgo doesn't exactly use all c# ability as I use visual studio to do part of my programming. I hope this thread will serve as a reference point to all those out there looking to achieve what is set out in the topic space.

Regards,

Tony


@HTtrader

HTtrader
19 Oct 2017, 23:10

Hi Panagiotis,

It still seems to be crashing despite my efforts to work this out, I have tried the following that builds but still crashes the bot

if ((Positions.FindAll(PositionId)) != null)
{            
foreach (var position in Positions)
            {
                if (Symbol.Code == position.SymbolCode)
                {
                    if (Symbol.Ask > midbb)
                    {
                        ModifyPositionAsync(position, topnow, bottomnow);
                        Print("New Position TP price is {0}", position.TakeProfit);
                    }
                    else if (Symbol.Bid < midbb)
                    {
                        ModifyPositionAsync(position, bottomnow, topnow);
                        Print("New Position TP price is {0}", position.TakeProfit);
                    }
                }
            }
}

I then thought to add a function to find out if there is any positions with the label present with following

if ((Positions.FindAll(PositionId)) = null)

but the build doesn't work and I have tried declaring it as a variable prior

var positions = Positions.FindAll(PositionID);
if ((positions = null);
{
//do something
}
else
{
//continue
}

but that doesn't seem to work either. Am I using the wrong syntax or parts of code to identify any position in the list of positions as being null on a return of the FindAll?


@HTtrader

HTtrader
17 Oct 2017, 22:57

Hi Panagiots,

I am nearly there with this code.I made the adjustments as recommended however noticed that the code would need to be altered for each successive day. I think I may have found another approach which suits better. Please see code below

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(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        private DateTime _date;
        protected override void OnStart()
        {
            int month = System.DateTime.Now.Month;
            int day = System.DateTime.Now.Day;

            _date = new DateTime(2017, month, day, 11, 30, 0);
        
            var close = MarketSeries.Close[MarketSeries.OpenTime.GetIndexByExactTime(_date)];
        }
 
        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

I just need a little help with 1 line of the code, since we are requesting the current day as an int, however I would like to get the previous value for calculation purposes. I have tried the .Last function and -1 but both show up errors on the build. Any help and thoughts are greatly appreciated.

Thanks,

Tony


@HTtrader

HTtrader
12 Oct 2017, 23:14

Hi Panagiotis,

After days of testing this is the right piece of code that I am after. However I am looking to modify it now. I need it to be able to change with every 24 hours (1 day) to be a rolling input in my further cbot calculations. I have tried the following but to no avail.

var close = MarketSeries.Close[MarketSeries.OpenTime.GetIndexByExactTime(new DateTime(2017, 10, 9, 11, 30, 0).AddDays(1))];

Is there something that I am missing to make this rollover with each new day?


@HTtrader

HTtrader
12 Oct 2017, 23:10

Hi Panagiotis,

I have managed to isolate the issue now and find that this piece of code is the issue

        void OnPositionsOpened(PositionOpenedEventArgs obj)
        {
            <strong>if</strong> (Symbol.Code == obj.Position.SymbolCode)
            {
                _lastExecutedOrder = DateTime.Now;
            }
        }

when a position opens on another instance of the same cbot it can't recognise the difference and hence crashes, meaning only that instance that has the position opened stays active.

For example if I had a Eur/USD and USDYEN instance on the 1 cbot when 1 position is open in EURUSD for instance the USDYEN bot looks at the same open position and crashes. However I don't understand as there is code there that ties that particular instance to the symbol code.

Is there a way to get around this with another if clause?

Thanks,

Tony


@HTtrader

HTtrader
09 Oct 2017, 23:49

Hi Panagiotis, The function I am after is to get the close of a certain candle within the day irrespective of the time my cbot is started and the current time. For example getting the close of the hourly candle of 2 hours before the New York open if my cbot is set to Tasmaniastandardtime. All the previous examples given calculate the value from the current candle. If this is not possible is there another way to achieve the result I am after? Thanks,
@HTtrader

HTtrader
09 Oct 2017, 23:18

Hi Panagiotis,

This has partially solved the problem however I had to modify the code a bit which is where the problem might lie. The code above you gave returned me this error

Error CS1579: foreach statement cannot operate on variables of type 'cAlgo.API.Position' because 'cAlgo.API.Position' does not contain a public definition for 'GetEnumerator'

However when I put the following

foreach (var position in Positions.FindAll(PositionId))

it builds perfectly and works as it should across multiple cbots but not multiple instances of the cbot I am doing further testing tonight but can I get a response to why it won't find 1 label and needs to find all of them instead to work?


@HTtrader

HTtrader
04 Oct 2017, 23:18

Hi Panagiotis,

I am trying to find the variable in which to invoke to get a particular time I'm after with the following

MarketSeries.Close.Last(MarketSeries.OpenTime.Count - (MarketSeries.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime.LastValue) + 1));

I tried

MarketSeries.Close.Last(MarketSeries.OpenTime.Count - (MarketSeries.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime.Last(X)) + 1));

where X is the hour I'm after but that just calculates it from when the cbot is started.

I'm guessing that it is specifying the opentime somewhere as a precursor to being used in the formula is this correct?


@HTtrader

HTtrader
04 Oct 2017, 23:14

Hi Panagiotis,

Sorry have been a little busy with other things. Ok now to the problem at hand. The test of positions.count didn't work as planned as multiple positions could be opened at any one time so it will search for that across the board.

I had another thought would using 

if ((Positions.Find(label)) != null)

work, I have to fix up the syntax abit but that would isolate reference required to a particular cbot. My only other concern is the foreach section, can we compound the foreach to say something like this

foreach (var position.find(label) in Positions)
{
.
.
.
.
}

or is there another variation of this that I should be using?


@HTtrader

HTtrader
26 Sep 2017, 15:09

Hi Panagiotis,

Sorry you are right about the calculation and they processed correctly. However on testing tonight I have noticed that the code starts from when the cbot is first started it takes that as the calculation index series. I was hoping that it would take the values from a certain fixed time. Is there anyway to hard code this and could you possibly provide an example.

Thanks,

Tony 


@HTtrader

HTtrader
25 Sep 2017, 23:57

Hi Panagiotis,

I am starting to get confused now. I did some more testing overnight and everything ran fine with the code as is. I am guessing that is was a blue moon event that caused the crash a while back. Anyways I tried adjust the code to see if that would work but then ran into a build issue. I swapped the foreach line with the if symbol code hoping that would be a straightforward fix. However not as the build came up with not valid positions variable.

My only other thought is to add another if parameter to the line before of after the foreach clause saying to only apply to 

if (position.count >1);

I will test this out again tonigh but would also like your thoughts, or should I just keep running the same code as is?

Regards,

Tony


@HTtrader

HTtrader
22 Sep 2017, 16:06

Hi Panagoitis,

Sorry for the part messages as I was in the middle of changing devices. What I was meant to say above is that both cbots ran perfectly on testing tonight. I was running the 2 cbots on eurusd only and it performed as it should. However when it crashed the other night, I was running the cbots on multiple symbols, the code above  should exclude that error though, so I am a bit confused now. I can run one cbot at a time but that would be highly inefficient as I look for multiple opportunities across a range of symbols. Any help is much appreciated.


@HTtrader

HTtrader
22 Sep 2017, 15:50

Hi Panagoitis,
Please find attached sample code of what I am running when it crashes. It didn't crash tonight so I am a bit confused.
Both cbots build properly with no null reference.

// -------------------------------------------------------------------------------------------------
//		Market order testing modifying absolute TP &or SL
//		v3 15minute
//		

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Requests;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Threading;
using System.Threading.Tasks;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.TasmaniaStandardTime, AccessRights = AccessRights.None)]
    public class BBMarketO : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Stop Loss (pips)", DefaultValue = 40, MinValue = 1)]
        public int StopLossInPips { get; set; }

        [Parameter("Take Profit (pips)", DefaultValue = 40, MinValue = 1)]
        public int TakeProfitInPips { get; set; }

        [Parameter("Quantity (Lots)", DefaultValue = 0.5, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }

        [Parameter("Cooldown (hours)", DefaultValue = 2, MinValue = 1, Step = 1)]
        public double CD { get; set; }

        [Parameter("Bollinger Bands Deviations", DefaultValue = 2)]
        public double Deviations { get; set; }

        [Parameter("Bollinger Bands Periods", DefaultValue = 20)]
        public int Periods { get; set; }

        [Parameter("Bollinger Bands MA Type")]
        public MovingAverageType MAType { get; set; }

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

        public Position position;
        private DateTime _lastExecutedOrder;

        BollingerBands BBMO;


        protected override void OnStart()
        {
            BBMO = Indicators.BollingerBands(Source, Periods, Deviations, MAType);
        }

        protected override void OnBar()
        {
            var midbb = BBMO.Main.Last(0);
            var topnow = BBMO.Top.Last(0);
            var bottomnow = BBMO.Bottom.Last(0);
            var volumeInUnits = Symbol.QuantityToVolume(Quantity);


            if (Symbol.Ask > midbb)
            {
                if (_lastExecutedOrder.AddHours(CD) < DateTime.Now)
                {
                    ExecuteMarketOrderAsync(TradeType.Buy, Symbol, volumeInUnits, PositionId, null, null);
                    _lastExecutedOrder = DateTime.Now;
                }
            }
            else if (Symbol.Bid < midbb)
            {
                if (_lastExecutedOrder.AddHours(CD) < DateTime.Now)
                {
                    ExecuteMarketOrderAsync(TradeType.Sell, Symbol, volumeInUnits, PositionId, null, null);
                    _lastExecutedOrder = DateTime.Now;
                }
            }

            foreach (var position in Positions)
            {
                if (Symbol.Code == position.SymbolCode)
                {
                    if (Symbol.Ask > midbb)
                    {
                        ModifyPositionAsync(position, topnow, bottomnow);
                        Print("New Position TP price is {0}", position.TakeProfit);
                    }
                    else if (Symbol.Bid < midbb)
                    {
                        ModifyPositionAsync(position, bottomnow, topnow);
                        Print("New Position TP price is {0}", position.TakeProfit);
                    }
                }
            }
        }

        protected override void OnStop()
        {
            Stop();
        }
    }
}
// -------------------------------------------------------------------------------------------------
//        Limit order testing with expiration and modifying absolute TP&orSL
//        v3 15min
//        

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Requests;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Threading;
using System.Threading.Tasks;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.TasmaniaStandardTime, AccessRights = AccessRights.None)]
    public class BBLO : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Stop Loss (pips)", DefaultValue = 40, MinValue = 1)]
        public int StopLossInPips { get; set; }

        [Parameter("Take Profit (pips)", DefaultValue = 40, MinValue = 1)]
        public int TakeProfitInPips { get; set; }

        [Parameter("Quantity (Lots)", DefaultValue = 0.5, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }

        [Parameter("Cooldown (hours)", DefaultValue = 2, MinValue = 1, Step = 1)]
        public double CD { get; set; }

        [Parameter("Bollinger Bands Deviations", DefaultValue = 2)]
        public double Deviations { get; set; }

        [Parameter("Bollinger Bands Periods", DefaultValue = 20)]
        public int Periods { get; set; }

        [Parameter("Bollinger Bands MA Type")]
        public MovingAverageType MAType { get; set; }

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

        public Position position;
        private DateTime _lastExecutedOrder;

        BollingerBands BB;


        protected override void OnStart()
        {
            BB = Indicators.BollingerBands(Source, Periods, Deviations, MAType);
            Positions.Opened += OnPositionsOpened;
        }

        void OnPositionsOpened(PositionOpenedEventArgs obj)
        {
            if (Symbol.Code == obj.Position.SymbolCode)
            {
                _lastExecutedOrder = DateTime.Now;
            }
        }

        protected override void OnBar()
        {

            var midbb = BB.Main.Last(0);
            var topnow = BB.Top.Last(0);
            var bottomnow = BB.Bottom.Last(0);

            var volumeInUnits = Symbol.QuantityToVolume(Quantity);
            var expiry = Time.AddMinutes(15);


            if (_lastExecutedOrder.AddHours(CD) < DateTime.Now)
            {
                //higher than indicator target price
                PlaceLimitOrder(TradeType.Sell, Symbol, volumeInUnits, topnow + 5 * Symbol.PipSize, PositionId, StopLossInPips, null, expiry);
                //lower than indicator target price
                PlaceLimitOrder(TradeType.Buy, Symbol, volumeInUnits, bottomnow - 5 * Symbol.PipSize, PositionId, StopLossInPips, null, expiry);
            }

            foreach (var position in Positions)
            {
                if (Symbol.Code == position.SymbolCode)
                {
                    ModifyPositionAsync(position, position.StopLoss, midbb);
                    Print("New Position TP price is {0}", position.TakeProfit);
                }
            }
        }

        protected override void OnStop()
        {
            Stop();
        }
    }
}

@HTtrader

HTtrader
22 Sep 2017, 15:46

Ok now this has got me puzzled it works sometimes and doesn't the others. I did more testing tonight and the results showed positive for all tests. I ran both cbots on the same symbol eurusd. Please see the code below. There is no null reference error when I build the cbot. I have gone through and tried to make all parameters unique so this has got me puzzled. The only other thing I can think of is I ran the code on different symbols and more than 1 instance the other time when it crashed. Any help is much appreciated.

// -------------------------------------------------------------------------------------------------
//		Limit order testing with expiration and modifying absolute TP&orSL
//		v3 15min
//		

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Requests;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Threading;
using System.Threading.Tasks;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.TasmaniaStandardTime, AccessRights = AccessRights.None)]
    public class BBLO : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Stop Loss (pips)", DefaultValue = 40, MinValue = 1)]
        public int StopLossInPips { get; set; }

        [Parameter("Take Profit (pips)", DefaultValue = 40, MinValue = 1)]
        public int TakeProfitInPips { get; set; }

        [Parameter("Quantity (Lots)", DefaultValue = 0.5, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }

        [Parameter("Cooldown (hours)", DefaultValue = 2, MinValue = 1, Step = 1)]
        public double CD { get; set; }

        [Parameter("Bollinger Bands Deviations", DefaultValue = 2)]
        public double Deviations { get; set; }

        [Parameter("Bollinger Bands Periods", DefaultValue = 20)]
        public int Periods { get; set; }

        [Parameter("Bollinger Bands MA Type")]
        public MovingAverageType MAType { get; set; }

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

        public Position position;
        private DateTime _lastExecutedOrder;

        BollingerBands BB;


        protected override void OnStart()
        {
            BB = Indicators.BollingerBands(Source, Periods, Deviations, MAType);
            Positions.Opened += OnPositionsOpened;
        }

        void OnPositionsOpened(PositionOpenedEventArgs obj)
        {
            if (Symbol.Code == obj.Position.SymbolCode)
            {
                _lastExecutedOrder = DateTime.Now;
            }
        }

        protected override void OnBar()
        {

            var midbb = BB.Main.Last(0);
            var topnow = BB.Top.Last(0);
            var bottomnow = BB.Bottom.Last(0);

            var volumeInUnits = Symbol.QuantityToVolume(Quantity);
            var expiry = Time.AddMinutes(15);


            if (_lastExecutedOrder.AddHours(CD) < DateTime.Now)
            {
                //higher than indicator target price
                PlaceLimitOrder(TradeType.Sell, Symbol, volumeInUnits, topnow + 5 * Symbol.PipSize, PositionId, StopLossInPips, null, expiry);
                //lower than indicator target price
                PlaceLimitOrder(TradeType.Buy, Symbol, volumeInUnits, bottomnow - 5 * Symbol.PipSize, PositionId, StopLossInPips, null, expiry);
            }

            foreach (var position in Positions)
            {
                if (Symbol.Code == position.SymbolCode)
                {
                    ModifyPositionAsync(position, position.StopLoss, midbb);
                    Print("New Position TP price is {0}", position.TakeProfit);
                }
            }
        }

        protected override void OnStop()
        {
            Stop();
        }
    }
}
// -------------------------------------------------------------------------------------------------
//		Market order testing modifying absolute TP &or SL
//		v3 15minute
//		

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Requests;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Threading;
using System.Threading.Tasks;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.TasmaniaStandardTime, AccessRights = AccessRights.None)]
    public class BBMarketO : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Stop Loss (pips)", DefaultValue = 40, MinValue = 1)]
        public int StopLossInPips { get; set; }

        [Parameter("Take Profit (pips)", DefaultValue = 40, MinValue = 1)]
        public int TakeProfitInPips { get; set; }

        [Parameter("Quantity (Lots)", DefaultValue = 0.5, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }

        [Parameter("Cooldown (hours)", DefaultValue = 2, MinValue = 1, Step = 1)]
        public double CD { get; set; }

        [Parameter("Bollinger Bands Deviations", DefaultValue = 2)]
        public double Deviations { get; set; }

        [Parameter("Bollinger Bands Periods", DefaultValue = 20)]
        public int Periods { get; set; }

        [Parameter("Bollinger Bands MA Type")]
        public MovingAverageType MAType { get; set; }

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

        public Position position;
        private DateTime _lastExecutedOrder;

        BollingerBands BBMO;


        protected override void OnStart()
        {
            BBMO = Indicators.BollingerBands(Source, Periods, Deviations, MAType);
        }

        protected override void OnBar()
        {
            var midbb = BBMO.Main.Last(0);
            var topnow = BBMO.Top.Last(0);
            var bottomnow = BBMO.Bottom.Last(0);
            var volumeInUnits = Symbol.QuantityToVolume(Quantity);


            if (Symbol.Ask > midbb)
            {
                if (_lastExecutedOrder.AddHours(CD) < DateTime.Now)
                {
                    ExecuteMarketOrderAsync(TradeType.Buy, Symbol, volumeInUnits, PositionId, null, null);
                    _lastExecutedOrder = DateTime.Now;
                }
            }
            else if (Symbol.Bid < midbb)
            {
                if (_lastExecutedOrder.AddHours(CD) < DateTime.Now)
                {
                    ExecuteMarketOrderAsync(TradeType.Sell, Symbol, volumeInUnits, PositionId, null, null);
                    _lastExecutedOrder = DateTime.Now;
                }
            }

            foreach (var position in Positions)
            {
                if (Symbol.Code == position.SymbolCode)
                {
                    if (Symbol.Ask > midbb)
                    {
                        ModifyPositionAsync(position, topnow, bottomnow);
                        Print("New Position TP price is {0}", position.TakeProfit);
                    }
                    else if (Symbol.Bid < midbb)
                    {
                        ModifyPositionAsync(position, bottomnow, topnow);
                        Print("New Position TP price is {0}", position.TakeProfit);
                    }
                }
            }
        }

        protected override void OnStop()
        {
            Stop();
        }
    }
}

 


@HTtrader

HTtrader
22 Sep 2017, 15:42

Thanks for the clarification Panagiotis, I am in the process of implementing the above parameters into my code but for some reason I am not getting the end results as expected. All variable calculate properly albeit a spread issue I think. Please see the code below, results and expected results

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Requests;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Threading;
using System.Threading.Tasks;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.TasmaniaStandardTime, AccessRights = AccessRights.None)]
    public class Pivot : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Start Hour", DefaultValue = 10)]
        public int StartTime { get; set; }

        protected override void OnStart()
        {
            var Daily = MarketData.GetSeries(TimeFrame.Daily);
            var Hour = MarketData.GetSeries(TimeFrame.Hour);
            var high = Daily.High.Last(1);
            var low = Daily.Low.Last(1);
            var close = Hour.Close.Last(StartTime);

            var PP = (high + low + close) / 3;
            var R1 = (2 * PP) - low;
            var S1 = (2 * PP) - high;

            Print("high", high);
            Print("low", low);
            Print("close", close);
            Print("R1", R1);
            Print("S1", S1);
            Print("pp", PP);
        }

        protected override void OnStop()
        {
            Stop();
        }
    }
}

Results:

22/09/2017 12:32:00.192 | high1.19537
22/09/2017 12:32:00.192 | low1.18657
22/09/2017 12:32:00.192 | close1.19952
22/09/2017 12:32:00.192 | R11.20107
22/09/2017 12:32:00.192 | S11.19227
22/09/2017 12:32:00.192 | pp1.19382

Expected Results:

R1 = 1.20036

S1= 1.19058

PP = 1.19398

I have made the proper calculations above so any help on this issue is much appreciated. I think the Close is out too but still the S1 value shouldn't be that far off.

 


@HTtrader

HTtrader
21 Sep 2017, 00:13

Ok I am really starting to get confused now. Just ran the 2 cbots on the same symbol and both produced the results as I would expect. My guess now is it would have to do something with order execution on the server side. Would a adding a 1 or 2 minute delay help in this case? Or is this issue totally unrelated. 

I can work with the bots individually but would be nice if they all worked together so I can maximise my efficiency.


@HTtrader

HTtrader
20 Sep 2017, 23:55

20/09/2017 09:00:00.472 | Crashed in OnBar with NullReferenceException: Object reference not set to an instance of an object.

That is the crash report from one of the cbots. The cbots work fine as an independent on their own but when I run another cbot on the same symbol this problem arises. Both cbots have trigger clauses onBar to enter the market. Panagiotis have you seen this before and could you possibly provide a sample of how I can get around this issue. My guess is the indicators that are called upon are not tied to the symbol but then isn't that the job of the cbot I am getting confused now.


@HTtrader

HTtrader
20 Sep 2017, 23:49

I have found this piece of code now that might be able to help me do what I need but there is not much information out there on how to use it. Can someone possibly give me a sample of how they have used it.

var indexSeries2 = indexSeries2.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime.LastValue);

As I understand it you can get a particular hr value in the day say the close of 0800 or 1600 candle depending on your timezone class for your bot. I am just having a bit of trouble with the syntax at the moment. Any help is much appreciated.


@HTtrader