Topics
17 May 2022, 11:22
 936
 3
14 Dec 2020, 13:38
 1542
 3
Replies

ClickAlgo
24 Dec 2015, 01:44 ( Updated at: 25 Jan 2016, 00:02 )

Hi Luke,

Did you pay via PayPal? if so you can apply for a refund. I would also contact Spotware and tell them the situation, copy the email's you sent to the consultant. Spotware should also attempt to contact the company and try to resolve this.

Sorry to hear that this happened. I hope you get it sorted.

Merry Christmas

Paul.


@ClickAlgo

ClickAlgo
22 Dec 2015, 10:24

The application programming interface (API) just exposes a set of routines to the trading platform, it is in the .NET framework that you write your logic to achieve what you need.If you feel that you need a separate process to get prices while your robot is busy doing another task then you may need to use Asynchronous Parallel programming . We now have the BeginInvokeOnMainThread method included in the cAlgo API  to make this easier to implement.


@ClickAlgo

ClickAlgo
21 Dec 2015, 22:05

This may solve your problem, load your prices asynchronously at the start. you can break up the calls into work packets if you need the data quicker.

/forum/cbot-support/7593?page=1#6


@ClickAlgo

ClickAlgo
21 Dec 2015, 20:59

Thank you very much Spotware team.


@ClickAlgo

ClickAlgo
21 Dec 2015, 11:00

How often and how quickly do you need price updates for your strategy?

If the platform is not providing you with the functionality you require I would look at alternative methods to achieve what you want. Think about either having a separate robot that does nothing but get prices every 1 minute and storing the prices in either an xml, json file, database or any other persistent method to store data and your main robot reads this data every (x) mins/secs.

You could try using an thread if you are familiar with threading, but you have to be very careful as cAlgo.API is not thread safe and the entire application could crash.


@ClickAlgo

ClickAlgo
18 Dec 2015, 22:03

take a look at this old email, spotware have added this new method since then. have you used the cAlgo API method BeginInvokeOnMainThread ?

/forum/cbot-support/3155

 


@ClickAlgo

ClickAlgo
17 Dec 2015, 18:42

Forget the Tasks question, just information on the BeginInvokeOnMainThread , is it the same usage as xamarin examples.


@ClickAlgo

ClickAlgo
17 Dec 2015, 13:52

oops i made a mistake, it took 50 seconds to get all price data and NOT 1 minute 50 seconds


@ClickAlgo

ClickAlgo
17 Dec 2015, 13:51 ( Updated at: 21 Dec 2023, 09:20 )

I used your exact code and the results are below:

Delay to call onBar is 1 minute

each major pair's took approximately 3 seconds

total time to get all prices is about 1 minute 50 seconds

I would suggest putting a timer in your logic which gets prices that are not reliant on your instruments time-frame, if you every set your time-frame to 5 minutes, the robot will not even start getting prices until after 5 minutes has passed.

 

 


@ClickAlgo

ClickAlgo
17 Dec 2015, 13:04

If you give me the complete Get_Symbol code we can do a more detailed test.


@ClickAlgo

ClickAlgo
17 Dec 2015, 13:03 ( Updated at: 21 Dec 2023, 09:20 )

I have run your code and you will see in the log file the time of day for each event.

Nothing happens for (x) minutes which is the time-frame for the instrument, the onBar method is not called until this time has lapsed, the actual processing is very fast to get the prices.

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; }

        protected override void OnStart()
        {
            Print("cBot started at: " + DateTime.UtcNow.TimeOfDay);
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnBar()
        {
            Print("onBar method called at: " + DateTime.UtcNow.TimeOfDay);

            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    var Current_Symbol = GetSymbol(i, j);
                    var str_Current_Symbol = Current_Symbol.Code.ToString();
                    var Current_Symbol_PipSize = Current_Symbol.PipSize;
                    var t1 = MarketData.GetSeries(str_Current_Symbol, TimeFrame.Daily);

                    Print(i + "." + j + "          Daily Open Price " + str_Current_Symbol + "    =    " + t1.Open.LastValue, ToString());
                }

                Print("Processing stopped at: " + DateTime.UtcNow.TimeOfDay);
            }
        }

        private Symbol GetSymbol(int t_Pair, int t_value)
        {
            // simulates all pairs
            switch (t_value)
            {
                case 0:
                    return MarketData.GetSymbol("EURUSD");
                case 1:
                    return MarketData.GetSymbol("EURJPY");
                case 2:
                    return MarketData.GetSymbol("EURGBP");
                case 3:
                    return MarketData.GetSymbol("EURAUD");
                case 4:
                    return MarketData.GetSymbol("EURNZD");
                case 5:
                    return MarketData.GetSymbol("EURCHF");
                case 6:
                    return MarketData.GetSymbol("EURCAD");
                default:
                    return MarketData.GetSymbol("EURUSD");
            }
        }
    }
}

The log file is below, you will notice the delay before the method is called.

 


@ClickAlgo

ClickAlgo
16 Dec 2015, 23:39

can you show me the code for the Get_Symbol(i, j); method 


@ClickAlgo

ClickAlgo
16 Dec 2015, 23:30

Please accept my apologies, I have just tested my code again and it works now. I have no idea why it failed before, I should have re-started cAlgo and even re-booted my machine before reporting this bug. Sorry for wasting your time.

Paul.


@ClickAlgo

ClickAlgo
16 Dec 2015, 21:37

I bet your time-frame is 5 minutes, put a print hello in your method before the for-next statements, so before any processing starts.

You should see the hello displayed in the log file after 5 minutes and this should give you a clue as to what your problem is.

 

 


@ClickAlgo

ClickAlgo
01 Dec 2015, 17:58

If you want to copy to a VPS for example; just install the cBot like you would normally would and copy the TweetInvi assemblies across, create a folder in your robots directory where all the bots live and put the library files there so you can share the assemblies with other robots.

in cAlgo click on manage references of your robot then choose Libraries, browse to the folder where the Tweetinvi library files are located and add them, its a very simple and easy procedure.

There are some very good libraries out there which wrap up complex logic for programming languages and provide simple logic for what was once complex tasks, Microsoft has been doing this for years, their framework is just many libraries of wrapped up logic. The TweekInvi makes life very simple and increases productivity and simplicity allowing rapid development of software.

 


@ClickAlgo

ClickAlgo
30 Nov 2015, 22:11

I was using TweetInvi wrapper

https://tweetinvi.codeplex.com/

add the Nuget pachage to VS

https://www.nuget.org/packages/TweetinviAPI/

you will get the references I showed you above in your solution then simply write 3 meaningfully clear lines of code to send a tweet.

TwitterCredentials.SetCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
 
var tweet = Tweet.CreateTweet("this is your tweet");
var success = tweet.Publish();

good luck.


@ClickAlgo

ClickAlgo
30 Nov 2015, 22:07

i think the API call is a few lines of code, i do not know what you have there. I looked at my old code and it was simply less than 5 lines of code.

have you looked at the Twitter API?

another example

var service = new TweetSharp.TwitterService("ConsumerKey","ConsumerSecret","TokenKey","TokenSecretKey"); //Replace keys with values from step #5
var twitterStatus = service.SendTweet(new SendTweetOptions() { Status ="Hello World" });
if (twitterStatus != null)
{
    MessageBox.Show("It worked");
}

@ClickAlgo

ClickAlgo
30 Nov 2015, 20:49 ( Updated at: 21 Dec 2023, 09:20 )

Also you will what these references or get them from NuGet.


@ClickAlgo

ClickAlgo
30 Nov 2015, 20:47

Its pretty simple to send a tweet with C# using twitter API, you need to open a twitter account that you want to post from and get your authentication codes, it has been a while since i worked on the twitter API, but it is something like this:

// TwitterCredentials.SetCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
TwitterCredentials.SetCredentials("2252688033-b20s6VyUbgMhhq60mgt8H5i1FlT2IkG", "Gb6q86w7WZR0BCFbPbeRMLLbxcMKowODjN8Ho4SdW", "1EDHuiqKRaor771Fu7SCy", "pguFU6zPYALGBtReR5vElfBLM78PLoSKbI23oGudh");

var tweet = Tweet.CreateTweet("this is your tweet");
var success = tweet.Publish();

you can also tweet with media images, so you can auto tweet every time you win a trade with a screen shot if your clever.

have fun.


@ClickAlgo