Topics
30 Aug 2024, 11:09
 0
 165
 0
15 Aug 2024, 13:12
 0
 151
 0
23 Jul 2024, 17:30
 0
 233
 0
02 Jun 2024, 00:49
 2
 363
 3
14 Apr 2024, 00:05
 362
 4
15 Jan 2024, 06:08
 483
 3
Replies

Waxy
20 Mar 2017, 04:30

Thank you Lucian, 

I drop this in case someone else needs it,

        string[] _Codes = new string[] 
        {
            "EURUSD",
            "GBPUSD",
            "EURJPY",
            "USDJPY",
            "AUDUSD",
            "USDCHF",
            "GBPJPY",
            "USDCAD",
            "EURGBP",
            "EURCHF",
            "AUDJPY",
            "NZDUSD",
            "CHFJPY",
            "EURAUD",
            "CADJPY",
            "GBPAUD",
            "EURCAD",
            "AUDCAD",
            "GBPCAD",
            "USDNOK",
            "AUDCHF",
            "USDMXN",
            "GBPNZD",
            "CADCHF",
            "USDSEK",
            "GBPCHF",
            "EURRUB",
            "USDRUB",
            "USDCHN",
            "EURSEK",
            "GBPZAR",
            "USDTRY",
            "NZDCHF",
            "EURPLN",
            "USDZAR",
            "EURMXN",
            "EURDKK",
            "EURHUF",
            "SGDJPY",
            "EURNOK",
            "EURHKD",
            "GBPNOK",
            "USDHUF",
            "NZDCAD",
            "EURZAR",
            "EURCZK",
            "NZDSGD",
            "USDPLN",
            "EURNZD",
            "AUDNZD",
            "EURTRY",
            "USDDKK",
            "NZDJPY",
            "USDCZK",
            "USDSGD",
            "GBPSGD",
            "GBPSEK",
            "AUDDKK",
            "AUDSGD",
            "AUDZAR",
            "CADMXN",
            "CHFNOK",
            "CHFSGD",
            "CHFZAR",
            "DKKNOK",
            "DKKSEK",
            "EURCNH",
            "EURRON",
            "EURSGD",
            "GBPDKK",
            "GBPTRY",
            "HKDJPY",
            "NOKJPY",
            "NOKSEK",
            "NZDSEK",
            "USDRON",
            "ZARJPY",
            "SEKJPY"
        };

 


@Waxy

Waxy
11 Nov 2016, 18:22

I think this cannot be done for the moment with the current API.


@Waxy

Waxy
28 Jul 2016, 18:09

I think Positions.Find() is not tracking orders correctly because of the comments (I have many orders with the same label but different comments), I'll try to check if this is true.


@Waxy

Waxy
12 Jul 2016, 06:05

look it up with history, you can do:

            foreach (var hist in History)
            {
                if (hist.ClosingPrice == 1)
                {
                    //Do Stuff
                }
            }
            //
            HistoricalTrade _hist = History.FindLast("Label");
            Print(_hist.ClosingPrice);
            //
            HistoricalTrade[] _histlist = History.FindAll("Label");
            Print(_hist.ClosingPrice);

 


@Waxy

Waxy
24 May 2016, 05:49

Thank you galafrin, can't believe I had no idea of this.

So my purpose was to use a function for a range (day) and skip the weekends, I had to find a more reliable source code, tho not efficient it works, anyway I'll post it here.

            DayOfWeek _ref = MarketSeries.OpenTime.LastValue.DayOfWeek;
            int i = 0;
            int _auxday = 1;
            while (_auxday < _DaysToCompute)
            {
                if (MarketSeries.OpenTime.Last(i).DayOfWeek == _ref)
                {
                    i++;
                }
                else
                {
                    _ref = MarketSeries.OpenTime.Last(i).DayOfWeek;
                    UseFunctionForDayBack(_auxday);
                    _auxday++;
                }
            }

 


@Waxy

Waxy
28 Apr 2016, 04:25

I'll give a try to quickfixn!


@Waxy

Waxy
27 Apr 2016, 19:22

I agree with mindbreaker I'm lost with this new feature, please provide some examples.


@Waxy

Waxy
20 Apr 2016, 02:27

RE:

Please let me know if you fix it, I'm curious about why this is happening.


@Waxy

Waxy
19 Apr 2016, 22:25

Hello Spotware

Now it works fine, I thought I had some library missing or something.

Both making new cBots and Indicators is fixed.

Thank you


@Waxy

Waxy
19 Apr 2016, 22:07

So the latest update (today) fixed this for me, what about you .ics?


@Waxy

Waxy
14 Apr 2016, 21:28

Just tested on cBots and it throws the same error.


@Waxy

Waxy
14 Apr 2016, 19:52

As you said: 

MarketSeries EURUSD = MarketData.GetSeries("EURUSD", TimeFrame.Minute);

Then:

double _open = EURUS.Open.Last(_numberofbarsago);

 


@Waxy

Waxy
12 Apr 2016, 00:28

I'm sorry, but you asked for this:

I would like to get the MarketSeries of the current chart timeframe

Also about GetSeries, I think it's not possible to get timeframe tick data.


@Waxy

Waxy
06 Apr 2016, 21:13

Hello fcomanjoncabeza

Even easier, just do:

var _CurrentTF = MarketSeries.TimeFrame;

 


@Waxy

Waxy
01 Apr 2016, 06:09

Use a random label generator function and run it before placing the first trade, here's mine:

        protected string GetLabel(string _TType)
        {
            Random rn = new Random(10);
            int x = rn.Next(100, 10000);
            _Label = _TType + x.ToString();

            var _CLD = History.FindLast(_Label);
            var _CLO = Positions.Find(_Label);
            while (_CLD != null || _CLO != null)
            {
                x++;
                _Label = _TType + x.ToString();
                _CLD = History.FindLast(_Label);
                _CLO = Positions.Find(_Label);
                //Theres a duplicated Label, finding another one
            }
            return _Label;
        }

Then do something like

string Label = GetLabel(Symbol.Code);

 


@Waxy

Waxy
01 Apr 2016, 06:01

This code has some bugs

First: You can't close a position that's already closed, most of your code happens when a position is closed, so you can't ask it to close it again, you could check it throws an error with: "Entity not found"

TradeResult OperationResult = ClosePosition(position);
                    if (!OperationResult.IsSuccessful)
                    {
                        Print("Operation could not be done, error: {0}",OperationResult.Error);
                    }

Second: You don't reset the counter if the last position is profitable, btw if you want to check the losers in a row do this.

            int losercount = 0; //declare it earlier
            foreach (var hist in History)
            {
                if (hist.Label == "Martingale") //within your bot trade history
                {
                    if (hist.NetProfit < 0)
                    {
                        losercount++;
                        if (losercount == 3)
                            Stop();
                    }
                    else
                    {
                        losercount = 0;
                    } 
                }
            }

 


@Waxy

Waxy
31 Mar 2016, 11:00 ( Updated at: 21 Dec 2023, 09:20 )

Click Solution -> Add -> Existing Item

Make sure to click "Add as Link"


@Waxy

Waxy
26 Mar 2016, 09:14 ( Updated at: 29 Mar 2016, 12:45 )

Fixed


@Waxy

Waxy
25 Mar 2016, 17:38 ( Updated at: 29 Mar 2016, 12:45 )

Hello

Since last update I'm having some trouble with some bots while optimizing, the platform crashes and closes without reporting any error, I would like to know how to fix this issue and I don't know if it's the platform or these bots, I don't have the source code.

The error:

System.StackOverflowException was unhandled
Message: An unhandled exception of type 'System.StackOverflowException' occurred in System.dll

 


@Waxy

Waxy
06 Mar 2016, 05:03

Last 0 is for the current value at the first moment of calculation of the bar.
Last 1 is for the value on the previous bar at its end.


@Waxy