Source code is not available
Source code is not available
07 Aug 2022, 12:55
Source code is not available
After upgrading from CAlgo 4.1 to 4.218 I have problem with my robot.
I have CAlgo robot inherited from class from dll.
In this case after compilation I can't see robot code in CAlgo :
"Source code is not available". Why ?
And how to solve this problem ?
(In the old version CAlgo this issue does not occur)
Regards
Replies
nk.nguyenkhuong
08 Aug 2022, 09:05
RE: Source code is not available, Bot can't use the new update Ctrader 4.2.16, please fix it. Thank you
PanagiotisCharalampous said:
Hi there,
Can you please provide us with the cBot source code and exact steps steps to reproduce this behavior?
Best Regards,
Panagiotis
using
System;
using
System.Linq;
using
cAlgo.API;
using
cAlgo.API.Indicators;
using
cAlgo.API.Internals;
using
cAlgo.Indicators;
namespace
cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public
class
my_tsl : Robot
{
[Parameter(
"Instance Name"
, DefaultValue =
""
)]
public
string
InstanceName {
get
;
set
; }
[Parameter(
"Include Trailing Stop"
, DefaultValue =
true
)]
public
bool
IncludeTrailingStop {
get
;
set
; }
[Parameter(
"Trailing Stop Trigger (pips)"
, DefaultValue = 2)]
public
double
TrailingStopTrigger {
get
;
set
; }
[Parameter(
"Trailing Stop Step (pips)"
, DefaultValue = 1)]
public
double
TrailingStopStep {
get
;
set
; }
protected
override
void
OnStart()
{
// Put your initialization logic here
}
protected
override
void
OnTick()
{
if
(IncludeTrailingStop)
{
SetTrailingStop();
}
// Put your core logic here
}
private
void
SetTrailingStop()
{
var sellPositions = Positions.FindAll(InstanceName, Symbol, TradeType.Sell);
foreach
(Position position
in
sellPositions)
{
double
distance = position.EntryPrice - Symbol.Ask;
if
(distance < TrailingStopTrigger * Symbol.PipSize)
continue
;
double
newStopLossPrice = Symbol.Ask + TrailingStopStep * Symbol.PipSize;
if
(position.StopLoss ==
null
|| newStopLossPrice < position.StopLoss)
{
ModifyPosition(position, newStopLossPrice, position.TakeProfit);
}
}
var buyPositions = Positions.FindAll(InstanceName, Symbol, TradeType.Buy);
foreach
(Position position
in
buyPositions)
{
double
distance = Symbol.Bid - position.EntryPrice;
if
(distance < TrailingStopTrigger * Symbol.PipSize)
continue
;
double
newStopLossPrice = Symbol.Bid - TrailingStopStep * Symbol.PipSize;
if
(position.StopLoss ==
null
|| newStopLossPrice > position.StopLoss)
{
ModifyPosition(position, newStopLossPrice, position.TakeProfit);
}
}
}
protected
override
void
OnStop()
{
// Put your deinitialization logic here
}
}
}
@nk.nguyenkhuong
PanagiotisCharalampous
08 Aug 2022, 14:24
Hi there,
For some reason spaces are removed.
Can you fix and post again?
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
nk.nguyenkhuong
08 Aug 2022, 16:25
( Updated at: 21 Dec 2023, 09:22 )
RE: Hello, have a nice day. Please help me fix the bot bug because it doesn't work, thanks
PanagiotisCharalampous said:
Hi there,
For some reason spaces are removed.
Can you fix and post again?
Best Regards,
Panagiotis
@nk.nguyenkhuong
PanagiotisCharalampous
08 Aug 2022, 16:36
Hi,
I don't see any errors just some warnings that are self explanatory.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
nk.nguyenkhuong
08 Aug 2022, 16:41
RE: I tried to "build" the source code. But unfortunately it didn't work. please help me, thanks
PanagiotisCharalampous said:
Hi,
I don't see any errors just some warnings that are self explanatory.
Best Regards,
Panagiotis
@nk.nguyenkhuong
PanagiotisCharalampous
08 Aug 2022, 16:43
Hi,
The green message says that the build was successful.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
nk.nguyenkhuong
08 Aug 2022, 16:50
RE: Hello, have a nice day. Please help me fix the bot bug because it doesn't work, thanks
PanagiotisCharalampous said:
Hi,
The green message says that the build was successful.
Best Regards,
Panagiotis
Thanks for your help I have successfully built the source code and I start the bot but the bot is not working, I don't know where I am doing wrong, please help, thanks
@nk.nguyenkhuong
nk.nguyenkhuong
08 Aug 2022, 17:13
( Updated at: 21 Dec 2023, 09:22 )
RE: Hello, have a nice day
For the bot to run but the command is not executed, is the bot not working, while the old version of Ctrader bot can use it normally?PanagiotisCharalampous said:
Hi,
The green message says that the build was successful.
Best Regards,
Panagiotis
@nk.nguyenkhuong
PanagiotisCharalampous
08 Aug 2022, 08:49
Hi there,
Can you please provide us with the cBot source code and exact steps steps to reproduce this behavior?
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous