Topics
21 Jan 2025, 11:18
 123
 1
09 Jan 2025, 09:13
 106
 1
16 Oct 2024, 19:30
 389
 3
12 Sep 2024, 18:33
 320
 1
Replies

rosscortb
10 Jan 2025, 12:24 ( Updated at: 21 Jan 2025, 21:07 )

RE: RE: RE: switching between accounts in cbot

PanagiotisCharalampous said: 

prihod007 said: 

PanagiotisCharalampous said: 

Hi there,

This is not possible. If you want to copy trades between accounts, you can consider cMAM

https://clickalgo.com/ctrader-trade-copy

Best regards,

Panagiotis

Thanks, but this is a paid third-party product. 
And how can a developer do this on their own through direct cTrader services without buying cMAM ?

cMAM is free but if you want to develop something like this from scratch, have a look at Open API

https://openapi.ctrader.com

Best regards,

Panagiotis

Hello,

 

When running a cbot on desktop(VPS) on my demo account, why when I change to my live account, is the same cbot now active on my live account?

Thanks

 

Ross


@rosscortb

rosscortb
18 Oct 2024, 09:55

RE: Stop Loss Calculation

firemyst said: 

Depends on what you want.

You're getting the LastValue, which is value as of the moment it's taken in the current bar. As you know, values for the current bar can change depending on what the price does. 

So at the beginning of the bar for example, the top band could be one value, but then if price really skyrockets and the band expands, the top band could end up being another value by the close of the bar.

If that's what you want, fine.

Perhaps what you want is the value of the previous bar when price closed? With Bollinger Bands, that shouldn't change. So instead of getting the .LastValue, you need to get .Last(1).

 

@firemyst
Thanks for your reply.

This never really worked me, been struggling with this for a while. When back testing I would expect to see a stop loss line or Take profit line above or below the bands. No matter what pip level I set the variable to just stays the same.


@rosscortb

rosscortb
03 Oct 2024, 14:16 ( Updated at: 04 Oct 2024, 05:17 )

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
   [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
   public class DoubleSMABotinTick : Robot
   {
       [Parameter("Volume", DefaultValue = 10000)]
       public int volume { get; set; }

       [Parameter("SMA1 Period", DefaultValue = 3)]
       public int PeriodsSma1 { get; set; }

       [Parameter("SMA2 Period", DefaultValue = 3)]
       public int PeriodsSma2 { get; set; }

       [Parameter("SMA1 Pips", DefaultValue = 5)]
       public int SMA1_Pips { get; set; }

       [Parameter("SMA2 Pips", DefaultValue = 5)]
       public int SMA2_Pips { get; set; }

       [Parameter("Take Profit", DefaultValue = 5)]
       public int TP { get; set; }

       [Parameter("Stop Loss", DefaultValue = 5)]
       public int SL { get; set; }

       private SimpleMovingAverage _sma1;
       private SimpleMovingAverage _sma2;

       protected override void OnStart()
       {
           _sma1 = Indicators.SimpleMovingAverage(Bars.HighPrices, PeriodsSma1);
           _sma2 = Indicators.SimpleMovingAverage(Bars.LowPrices, PeriodsSma2);
       }

       protected override void OnTick()
       {
           double pipValue = Symbol.PipSize * SMA1_Pips;

           if (IsPoOpen() && Symbol.Bid > _sma1.Result.LastValue + pipValue)
           {
               ExecuteMarketOrder(TradeType.Sell, SymbolName, volume, "DSMA", SL, TP);
           }

           if (IsPoOpen() && Symbol.Ask < _sma2.Result.LastValue - pipValue)
           {
               ExecuteMarketOrder(TradeType.Buy, SymbolName, volume, "DSMA", SL, TP);
           }
       }

       protected bool IsPoOpen()
       {
           var pos = Positions.FindAll("DSMA", SymbolName);
           return pos.Length == 0;
       }

       protected override void OnStop()
       {
           // Put your deinitialization logic here
       }
   }
}
 


@rosscortb