Replies

kei.3434.get
05 Dec 2023, 12:18 ( Updated at: 06 Dec 2023, 06:16 )

RE: Use the HIstoricalTrade object

firemyst said: 

You could look at the example Spotware provided:

https://help.ctrader.com/ctrader-automate/references/Trading/History/HistoricalTrade/#examples

 

thank you.

 


@kei.3434.get

kei.3434.get
03 Dec 2023, 01:04

RE: automatic close using cbot

PanagiotisCharalampous said: 

Hi there,

Yes you can. You cannot specify labels for manual positions, you can use comment instead.

Best regards,

Panagiotis

thank you very much


@kei.3434.get

kei.3434.get
30 Nov 2023, 07:04 ( Updated at: 30 Nov 2023, 12:06 )

RE: RE: Reply to: Get the win/loss of the previous trade
kei.3434.get said:

PanagiotisCharalampous said: 

Hi there,

Where did you get this code from? You need to share the complete cBot code in order for us to understand what the problem is.

Best regards,

Panagiotis

I got this code from chat gpt.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot4 : Robot
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        protected override void OnStart()
        {
              Print(Message);
        }
                        
        protected override void OnTradeExecuted(TradeRecord tradeRecord)
       {
           TradeResult lastTradeResult = null;

           if (lastTradeResult != null)
            {
           if (lastTradeResult.NetProfit >= 0)
            {
               Print("WIN!");
            }
           else if (lastTradeResult.NetProfit < 0)
            {
               Print("LOST!");
            }
    }
}

     
               

 


@kei.3434.get

kei.3434.get
30 Nov 2023, 07:04 ( Updated at: 30 Nov 2023, 12:06 )

RE: Reply to: Get the win/loss of the previous trade

PanagiotisCharalampous said: 

Hi there,

Where did you get this code from? You need to share the complete cBot code in order for us to understand what the problem is.

Best regards,

Panagiotis

I got this code from chat gpt.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot4 : Robot
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        protected override void OnStart()
        {
              Print(Message);
        }
                        
        protected override void OnTradeExecuted(TradeRecord tradeRecord)
       {
           TradeResult lastTradeResult = null;

           if (lastTradeResult != null)
            {
           if (lastTradeResult.NetProfit >= 0)
            {
               Print("WIN!");
            }
           else if (lastTradeResult.NetProfit < 0)
            {
               Print("LOST!");
            }
    }
}

     
               

 


@kei.3434.get