Replies

bazisfree
14 Oct 2023, 00:57

A possible solution...

Although I must admit I don't know what I'm really talking about much yet…

I will use a Nuget package called MessagePack to serialize the data and then use a Memory Mapped Writer / Reader to send and receive data between two cbots.
 

A big thanks to Spotware and Scyware.com to pointing me in the right direction and providing me with some code to adapt and use.


@bazisfree

bazisfree
13 Oct 2023, 07:06

RE: Can't get custom events from one cbot to another working

PanagiotisChar said: 

Hi,

You won't be able to do that this way since you do not have access to the cBot instance cTrader is running. Therefore you cannot listen to events of that instance. You need to consider other ways of communication e.g. reading/writing to files, named pipes etc.

Thank you. Do you have any examples of using pipes for this or something similar? Also, should I make these asynchronous or not necessary?

Cheers.

Baz


@bazisfree

bazisfree
23 Dec 2022, 10:12

RE: Thanks

PanagiotisChar said:

Hi there,

It's because of spread. Sell positions close on Ask prices, candles are drawn on Bid prices.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Thank you. A rookie misunderstanding. 


@bazisfree

bazisfree
23 Dec 2022, 06:20

RE: Please see screen shots

PanagiotisChar said:

Hi there,

If you could share some screenshots of the things you are describing, it would help.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Hi,

I posted the screen shots above, but didn't use this to reply, so you didn't get notified I guess.

Thanks for taking a look.

Baz

 


@bazisfree

bazisfree
21 Dec 2022, 12:57 ( Updated at: 21 Dec 2023, 09:23 )

SL jumped and exit into thin air

Hi,

@PanagiotisCharalampous @ PanagiotisChar

As can be seen below, the exit is not on a candle.

Forgive my ignorance, I'll admit I really don't understand all these position details etc, but the fact remains the deal map shows an exit much worse than the SL was set and in 'thin air'.


@bazisfree

bazisfree
12 Apr 2022, 10:57

RE: Thank you!

Hi Amusleh,

Thanks for that. I have used this to skip what I want and get the values for the last, second last etc. I am not finished coding all that I want but I think I should get there.

I'll make sure to post in the right place next time :)

Cheers,

Baz

 

amusleh said:

Hi,

You should open Automate related thread under automate section of forum not under cTrader desktop.

Regarding your question, you can use History, it contains all your account historical trades with all of their data, example:

using System.Linq;
using cAlgo.API;

namespace NewcBot
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        protected override void OnStart()
        {
            var lastTwoTrades = History.OrderByDescending(trade => trade.ClosingTime).Take(2).ToArray();

            foreach (var trade in lastTwoTrades)
            {
                Print("{0} | {1} | {2} | {3} | {4} | {5} | {6} | {7}", trade.SymbolName, trade.TradeType, trade.VolumeInUnits, trade.EntryPrice, trade.ClosingPrice, trade.Pips, trade.NetProfit, trade.Commissions); ;
            }
        }
    }
}

 

 


@bazisfree

bazisfree
11 Apr 2022, 08:55

How to look up and compare stats of trade history in cbot

Why is no one answering this? I am new to forums and this was my first post.

It was a reasonable question was it not? I'm not asking or expecting someone to write a program for me, I'm just needing some example code so that I can solve some problems and improve my trading algorithm.

I do not know if this tagging works but I'll try.

@PanagiotisCharalampous 

@amusleh

Cheers.


@bazisfree