Topics
Replies
ctrader.guru
08 Jul 2024, 07:43
( Updated at: 09 Jul 2024, 05:40 )
Watch this full video https://www.reddit.com/r/cTraderGuru/comments/1dxbttj/how_to_set_up_multiple_takeprofits_breakeven_and/
@ctrader.guru
ctrader.guru
22 May 2024, 07:22
RE: Cloud cBot issue
PanagiotisCharalampous said:
Hi cTrader Guru,
We will fix the cTrader ID issue in an update. However note that internet connectivity is not allowed for cloud cBots, you should consider this in case your licensing system needs this.
Best regards,
Panagiotis
Thanks for the quick response, actually I have already entered a parameter for the license, great job keep up the good work.
@ctrader.guru
ctrader.guru
11 Feb 2024, 06:41
( Updated at: 11 Feb 2024, 07:06 )
Try this approach https://github.com/cTrader-Guru/CallBack-Example/blob/master/CallBack%20Example/CallBack%20Example.cs
/* CTRADER GURU
Homepage : https://ctrader.guru/
Telegram : https://t.me/ctraderguru
Twitter : https://twitter.com/cTraderGURU/
Facebook : https://www.facebook.com/ctrader.guru/
YouTube : https://www.youtube.com/cTraderGuru
GitHub : https://github.com/ctrader-guru
LinkedIn : https://www.linkedin.com/company/ctrader-guru/
Discord : https://discord.gg/yE5XE3z5Nz
*/
using System;
using cAlgo.API;
using cTraderGuru.CallbackExample;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class CallBackExample : Robot
{
protected override void OnStart()
{
}
protected override void OnTick()
{
HelloWorld.Show(Print, Stop) ;
}
protected override void OnStop()
{
}
}
}
namespace cTraderGuru.CallbackExample {
public static class HelloWorld {
public static void Show(Action<string> MyPrint, Action MyStop) {
MyPrint( "Hello World cTrader Guru!" );
MyStop();
}
}
}
@ctrader.guru
ctrader.guru
09 Feb 2024, 06:00
Try this approach
using cAlgo.API;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class MyRobot : Robot
{
protected override void OnStart()
{
ChartTrendLine desiredLine = null;
foreach (ChartObject line in Chart.Objects)
{
if (line.ObjectType == ChartObjectType.TrendLine && line.Comment == "Your Comment")
{
desiredLine = (ChartTrendLine)line;
break;
}
}
// Access the desired line
if (desiredLine != null)
{
// Do something with the desired line
Print("Desired line value: " + desiredLine.Name);
}
else
{
Print("No line with the specified comment found.");
}
}
}
}
@ctrader.guru
ctrader.guru
29 Jan 2024, 16:23
RE: RE: Modify Positions is modiying takeprofit when it shouldn't
mihlali700 said:
ctrader.guru said:
Try changing in the foreach statement the return; with the continue;
The Trailing stop is working, what im trying to figure out is why I get a stop loss thats more than 1k pips away .
It would be better if you shared the whole source code, we will be able to help you better.
@ctrader.guru
ctrader.guru
28 Jan 2024, 06:35
Try changing in the foreach statement the return; with the continue;
@ctrader.guru
ctrader.guru
07 Jan 2024, 16:24
You can also remove the class that is no longer needed now:
using cAlgo.API;
using cAlgo.API.Internals;
using System;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.FullAccess)]
public class TradesRisky : Robot
{
[Parameter("Lots", Group = "Visual BackTest", MinValue = 0.01, DefaultValue = 0.37)]
public double MyLots { get; set; }
[Parameter("Stop Loss Take Profit", Group = "Visual BackTest", MinValue = 0, DefaultValue = 50)]
public double MyStops { get; set; }
protected override void OnStart()
{
Positions.Closed += OnPositionClosed;
Positions.Opened += OnPositionOpened;
Positions.Modified += OnPositionModified;
UpdateData();
// Open a new trade for testing visual mode
if (RunningMode == RunningMode.VisualBacktesting) ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.QuantityToVolumeInUnits(MyLots), null, MyStops, MyStops);
}
protected override void OnTick()
{
UpdateData();
}
public void OnPositionClosed(PositionClosedEventArgs args)
{
UpdateData();
}
public void OnPositionOpened(PositionOpenedEventArgs args)
{
UpdateData();
}
public void OnPositionModified(PositionModifiedEventArgs args)
{
UpdateData();
}
// Only if stoploss is set
private void UpdateData()
{
int trades = 0;
double pips = 0;
double lots = 0;
double money = 0;
double commissions = 0;
Position[] MyPositions = Positions.FindAll(null, SymbolName);
foreach (Position position in Positions)
{
if (position.StopLoss != null && position.StopLoss > 0)
{
trades++;
double currentstoploss = DigitsToPips( Math.Abs((double)position.StopLoss - position.EntryPrice) );
pips += currentstoploss;
lots += position.Quantity;
money += GetPipValueInMoney(currentstoploss, position.Quantity);
commissions += Math.Abs(Math.Round(position.Commissions, 2) * 2);
}
}
pips = Math.Round(pips, 2);
lots = Math.Round(lots, 2);
money = Math.Round(money, 2);
commissions = Math.Round(commissions, 2);
Chart.DrawStaticText("Trades", string.Format("Trades: {0}", trades), VerticalAlignment.Top,HorizontalAlignment.Left, Color.Red );
Chart.DrawStaticText("Pips", string.Format("\r\nPips: {0}", pips), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
Chart.DrawStaticText("Lots", string.Format("\r\n\r\nLots: {0}", lots), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
Chart.DrawStaticText("Money", string.Format("\r\n\r\n\r\nRisk: {0}", money), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
Chart.DrawStaticText("Commissions", string.Format("\r\n\r\n\r\n\r\nCommissions: {0}", commissions), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
Chart.DrawStaticText("Total Risk", string.Format("\r\n\r\n\r\n\r\n\r\nTotal Risk: {0}", Math.Round(money + commissions, 2)), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
}
// This function can be improved
private double GetPipValueInMoney(double pips, double lots)
{
double all_microlots = Math.Round(lots / 0.01, 2);
double multy = 100;
switch (Symbol.Digits)
{
case 3:
multy = 0.1;
break;
case 4:
case 5:
multy = 10;
break;
}
return Math.Round(pips * ( Symbol.PipValue / (Symbol.PipSize * multy) ) * all_microlots, 2);
}
private double DigitsToPips(double pips)
{
return Math.Round(pips / Symbol.PipSize, 2);
}
}
}
@ctrader.guru
ctrader.guru
07 Jan 2024, 16:20
Now I think I understand, you have to change your approach, I added some tricks:
using cAlgo.API;
using cAlgo.API.Internals;
using System;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.FullAccess)]
public class TradesRisky : Robot
{
class Risky
{
public double Pips { get; set; }
public double Commissions { get; set; }
public double Lots { get; set; }
}
[Parameter("Lots", Group = "Visual BackTest", MinValue = 0.01, DefaultValue = 0.37)]
public double MyLots { get; set; }
[Parameter("Stop Loss Take Profit", Group = "Visual BackTest", MinValue = 0, DefaultValue = 50)]
public double MyStops { get; set; }
protected override void OnStart()
{
Positions.Closed += OnPositionClosed;
Positions.Opened += OnPositionOpened;
Positions.Modified += OnPositionModified;
UpdateData();
// Open a new trade for testing visual mode
if (RunningMode == RunningMode.VisualBacktesting) ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.QuantityToVolumeInUnits(MyLots), null, MyStops, MyStops);
}
protected override void OnTick()
{
UpdateData();
}
public void OnPositionClosed(PositionClosedEventArgs args)
{
UpdateData();
}
public void OnPositionOpened(PositionOpenedEventArgs args)
{
UpdateData();
}
public void OnPositionModified(PositionModifiedEventArgs args)
{
UpdateData();
}
// Only if stoploss is set
private void UpdateData()
{
int trades = 0;
double pips = 0;
double lots = 0;
double money = 0;
double commissions = 0;
Position[] MyPositions = Positions.FindAll(null, SymbolName);
foreach (Position position in Positions)
{
if (position.StopLoss != null && position.StopLoss > 0)
{
trades++;
double currentstoploss = DigitsToPips( Math.Abs((double)position.StopLoss - position.EntryPrice) );
pips += currentstoploss;
lots += position.Quantity;
money += GetPipValueInMoney(currentstoploss, position.Quantity);
commissions += Math.Abs(Math.Round(position.Commissions, 2) * 2);
}
}
pips = Math.Round(pips, 2);
lots = Math.Round(lots, 2);
money = Math.Round(money, 2);
commissions = Math.Round(commissions, 2);
Chart.DrawStaticText("Trades", string.Format("Trades: {0}", trades), VerticalAlignment.Top,HorizontalAlignment.Left, Color.Red );
Chart.DrawStaticText("Pips", string.Format("\r\nPips: {0}", pips), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
Chart.DrawStaticText("Lots", string.Format("\r\n\r\nLots: {0}", lots), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
Chart.DrawStaticText("Money", string.Format("\r\n\r\n\r\nRisk: {0}", money), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
Chart.DrawStaticText("Commissions", string.Format("\r\n\r\n\r\n\r\nCommissions: {0}", commissions), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
Chart.DrawStaticText("Total Risk", string.Format("\r\n\r\n\r\n\r\n\r\nTotal Risk: {0}", Math.Round(money + commissions, 2)), VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
}
// This function can be improved
private double GetPipValueInMoney(double pips, double lots)
{
double all_microlots = Math.Round(lots / 0.01, 2);
double multy = 100;
switch (Symbol.Digits)
{
case 3:
multy = 0.1;
break;
case 4:
case 5:
multy = 10;
break;
}
return Math.Round(pips * ( Symbol.PipValue / (Symbol.PipSize * multy) ) * all_microlots, 2);
}
private double DigitsToPips(double pips)
{
return Math.Round(pips / Symbol.PipSize, 2);
}
}
}
@ctrader.guru
ctrader.guru
07 Jan 2024, 09:21
I am not sure I understand what you mean but I will try to answer with a concrete example and maybe start from this example to better understand what you need:
using cAlgo.API;
using cAlgo.API.Internals;
using System;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class TradesRisky : Robot
{
class Risky
{
public double Pips { get; set; }
public double Commissions { get; set; }
}
protected override void OnStart()
{
Positions.Modified += OnPositionModified;
UpdateData();
}
protected override void OnTick()
{
UpdateData();
}
public void OnPositionModified(PositionModifiedEventArgs args)
{
UpdateData();
}
private void UpdateData() {
Risky MyRisky = GetTotalPipsRisky();
double MoneyRisky = GetPipValueInMoney(MyRisky.Pips);
Chart.DrawStaticText("Risky",
string.Format("You are risking {0} pips for a total value of {1} {2} and {3} {2} commissions.", MyRisky.Pips, MoneyRisky, Account.Asset, MyRisky.Commissions),
VerticalAlignment.Top,
HorizontalAlignment.Left,
Color.Red
);
}
// This function can be improved
private double GetPipValueInMoney(double pips)
{
return Math.Round(pips * Symbol.PipValue / ( Symbol.PipSize * 100), 2);
}
private Risky GetTotalPipsRisky()
{
double pips = 0;
double commissions = 0;
Position[] MyPositions = Positions.FindAll(null, SymbolName);
foreach (Position position in Positions)
{
if (position.StopLoss != null && position.StopLoss > 0) pips += Math.Abs((double)position.StopLoss - position.EntryPrice);
commissions += position.Commissions;
}
return new Risky
{
Pips = DigitsToPips(pips),
Commissions = commissions
};
}
private double DigitsToPips(double pips)
{
return Math.Round(pips / Symbol.PipSize, 2);
}
}
}
@ctrader.guru
ctrader.guru
06 Jan 2024, 08:46
I think I understand, you don't need to manipulate the SMA, you can recreate it, this is a simple example:
using System;
using cAlgo.API;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
[Levels(0.0005)]
public class BodySMA : Indicator
{
[Parameter("Period", DefaultValue = 10, MinValue = 2)]
public int Period { get; set; }
[Output("Average", LineColor = "DodgerBlue")]
public IndicatorDataSeries Average { get; set; }
protected override void Initialize()
{
// TODO
}
public override void Calculate(int index)
{
if (index < Period) return;
double sum = 0;
for (int i = index - Period + 1; i <= index; i++)
{
sum += Math.Abs( Bars.ClosePrices[i] - Bars.OpenPrices[i]);
}
Average[index] = Math.Round( sum / Period, Symbol.Digits);
}
}
}
@ctrader.guru
ctrader.guru
05 Jan 2024, 12:14
I'm not sure what you want to do, but start with this approach, if you explain better what you want to achieve I can help you better
using cAlgo.API;
using cAlgo.API.Indicators;
using System;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class test : Indicator
{
protected override void Initialize()
{
SimpleMovingAverage sma = Indicators.SimpleMovingAverage(Bars.ClosePrices, 100);
double body = Math.Abs(Bars.ClosePrices.Last(0) - Bars.OpenPrices.Last(0));
double body_sma = sma.Result.Last(0) * 3.0;
}
public override void Calculate(int index)
{
}
}
}
@ctrader.guru
ctrader.guru
27 Dec 2023, 09:27
I honestly can't understand what you want to do, so in order to help you could you make a short video or some screenshots?
@ctrader.guru
ctrader.guru
27 Dec 2023, 09:22
I think you are talking about the Web version, the short answer is NO because modern browsers and application settings do not allow javascript code ignition. I hope I understand your question correctly, if not could you provide more details?
@ctrader.guru
ctrader.guru
27 Dec 2023, 09:06
This is a very rudimentary approach that can help you understand how to customize it
using System;
using cAlgo.API;
using cAlgo.API.Internals;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.EasternStandardTime, AccessRights = AccessRights.None)]
public class PivotPoint : Indicator
{
[Parameter("Only Last Day ?", DefaultValue = true)]
public bool OnlyLastDay { get; set; }
[Parameter("Show Labels", DefaultValue = true)]
public bool ShowLabels { get; set; }
[Parameter("Pivot Color", DefaultValue = "Magenta")]
public Color PivotColor { get; set; }
[Parameter("Support Color", DefaultValue = "Red")]
public Color SupportColor { get; set; }
[Parameter("Resistance Color", DefaultValue = "DodgerBlue")]
public Color ResistanceColor { get; set; }
private DateTime _previousPeriodStartTime;
private int _previousPeriodStartIndex;
private TimeFrame PivotTimeFrame;
protected override void Initialize()
{
if (TimeFrame <= TimeFrame.Hour)
{
PivotTimeFrame = TimeFrame.Daily;
}
else if (TimeFrame < TimeFrame.Daily)
{
PivotTimeFrame = TimeFrame.Weekly;
}
else
{
PivotTimeFrame = TimeFrame.Monthly;
}
}
private DateTime GetStartOfPeriod(DateTime dateTime)
{
return CutToOpenByNewYork(dateTime, PivotTimeFrame);
}
private DateTime GetEndOfPeriod(DateTime dateTime)
{
if (PivotTimeFrame == TimeFrame.Monthly)
{
return new DateTime(dateTime.Year, dateTime.Month, 1).AddMonths(1);
}
return AddPeriod(CutToOpenByNewYork(dateTime, PivotTimeFrame), PivotTimeFrame);
}
public override void Calculate(int index)
{
var currentPeriodStartTime = GetStartOfPeriod(Bars.OpenTimes[index]);
if (currentPeriodStartTime == _previousPeriodStartTime)
return;
if (index > 0)
CalculatePivots(_previousPeriodStartTime, _previousPeriodStartIndex, currentPeriodStartTime, index);
_previousPeriodStartTime = currentPeriodStartTime;
_previousPeriodStartIndex = index;
}
private void CalculatePivots(DateTime startTime, int startIndex, DateTime startTimeOfNextPeriod, int index)
{
DateTime currentOpenTime = Bars.OpenTimes[index];
DateTime today = DateTime.Now.AddDays(-1);
if (OnlyLastDay && currentOpenTime.Date.Day != today.Date.Day)
return;
var high = Bars.HighPrices[startIndex];
var low = Bars.LowPrices[startIndex];
var close = Bars.ClosePrices[startIndex];
var i = startIndex + 1;
while (GetStartOfPeriod(Bars.OpenTimes[i]) == startTime && i < Bars.ClosePrices.Count)
{
high = Math.Max(high, Bars.HighPrices[i]);
low = Math.Min(low, Bars.LowPrices[i]);
close = Bars.ClosePrices[i];
i++;
}
var pivotStartTime = startTimeOfNextPeriod;
var pivotEndTime = GetEndOfPeriod(startTimeOfNextPeriod);
var pivot = (high + low + close) / 3;
var r1 = 2 * pivot - low;
var s1 = 2 * pivot - high;
var r2 = pivot + high - low;
var s2 = pivot - high + low;
var r3 = high + 2 * (pivot - low);
var s3 = low - 2 * (high - pivot);
var r4 = high + 3 * (pivot - low);
var s4 = low - 3 * (high - pivot);
Chart.DrawTrendLine("pivot " + startIndex, pivotStartTime, pivot, pivotEndTime, pivot, PivotColor, 1, LineStyle.DotsVeryRare);
Chart.DrawTrendLine("r1 " + startIndex, pivotStartTime, r1, pivotEndTime, r1, ResistanceColor, 1, LineStyle.DotsRare);
Chart.DrawTrendLine("r2 " + startIndex, pivotStartTime, r2, pivotEndTime, r2, ResistanceColor, 1, LineStyle.Lines);
Chart.DrawTrendLine("r3 " + startIndex, pivotStartTime, r3, pivotEndTime, r3, ResistanceColor, 1, LineStyle.Solid);
Chart.DrawTrendLine("r4 " + startIndex, pivotStartTime, r4, pivotEndTime, r4, ResistanceColor, 1, LineStyle.Solid);
Chart.DrawTrendLine("s1 " + startIndex, pivotStartTime, s1, pivotEndTime, s1, SupportColor, 1, LineStyle.DotsRare);
Chart.DrawTrendLine("s2 " + startIndex, pivotStartTime, s2, pivotEndTime, s2, SupportColor, 1, LineStyle.Lines);
Chart.DrawTrendLine("s3 " + startIndex, pivotStartTime, s3, pivotEndTime, s3, SupportColor, 1, LineStyle.Solid);
Chart.DrawTrendLine("s4 " + startIndex, pivotStartTime, s4, pivotEndTime, s4, SupportColor, 1, LineStyle.Solid);
if (!ShowLabels)
return;
Chart.DrawText("Lpivot " + startIndex, "P " + pivot.ToString("N" + Symbol.Digits.ToString()), index, pivot, PivotColor);
Chart.DrawText("Lr1 " + startIndex, "R1 " + r1.ToString("N" + Symbol.Digits.ToString()), index, r1, ResistanceColor);
Chart.DrawText("Lr2 " + startIndex, "R2 " + r2.ToString("N" + Symbol.Digits.ToString()), index, r2, ResistanceColor);
Chart.DrawText("Lr3 " + startIndex, "R3 " + r3.ToString("N" + Symbol.Digits.ToString()), index, r3, ResistanceColor);
Chart.DrawText("Lr4 " + startIndex, "R4 " + r4.ToString("N" + Symbol.Digits.ToString()), index, r4, ResistanceColor);
Chart.DrawText("Ls1 " + startIndex, "S1 " + s1.ToString("N" + Symbol.Digits.ToString()), index, s1, SupportColor);
Chart.DrawText("Ls2 " + startIndex, "S2 " + s2.ToString("N" + Symbol.Digits.ToString()), index, s2, SupportColor);
Chart.DrawText("Ls3 " + startIndex, "S3 " + s3.ToString("N" + Symbol.Digits.ToString()), index, s3, SupportColor);
Chart.DrawText("Ls4 " + startIndex, "S4 " + s3.ToString("N" + Symbol.Digits.ToString()), index, s4, SupportColor);
}
private static DateTime CutToOpenByNewYork(DateTime date, TimeFrame timeFrame)
{
if (timeFrame == TimeFrame.Daily)
{
var hourShift = (date.Hour + 24 - 17) % 24;
return new DateTime(date.Year, date.Month, date.Day, date.Hour, 0, 0, DateTimeKind.Unspecified).AddHours(-hourShift);
}
if (timeFrame == TimeFrame.Weekly)
return GetStartOfTheWeek(date);
if (timeFrame == TimeFrame.Monthly)
{
return new DateTime(date.Year, date.Month, 1, 0, 0, 0, DateTimeKind.Unspecified);
}
throw new ArgumentException(string.Format("Unknown timeframe: {0}", timeFrame), "timeFrame");
}
private static DateTime GetStartOfTheWeek(DateTime dateTime)
{
return dateTime.Date.AddDays((double)DayOfWeek.Sunday - (double)dateTime.Date.DayOfWeek).AddHours(-7);
}
public DateTime AddPeriod(DateTime dateTime, TimeFrame timeFrame)
{
if (timeFrame == TimeFrame.Daily)
{
return dateTime.AddDays(1);
}
if (timeFrame == TimeFrame.Weekly)
{
return dateTime.AddDays(7);
}
if (timeFrame == TimeFrame.Monthly)
return dateTime.AddMonths(1);
throw new ArgumentException(string.Format("Unknown timeframe: {0}", timeFrame), "timeFrame");
}
}
}
@ctrader.guru
ctrader.guru
27 Dec 2023, 08:32
Try this approach
using cAlgo.API;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class Test : Robot
{
public enum CustomType
{
Low,
Medium,
High
}
[Parameter("P1", Group = "new type", DefaultValue = CustomType.Low)]
public CustomType P1 { get; set; }
private double fpsvsmasS_val
{
get
{
switch (P1)
{
case CustomType.Low:
return FPvsMAsVarsB;
case CustomType.Medium:
return FPvsMAsVarsS;
case CustomType.High:
return FPvsMAsVarsS;
}
return 0;
}
}
private double FPvsMAsVarsB = 10;
private double FPvsMAsVarsS = 20;
protected override void OnStart()
{
Print("Value of 'fpsvsmasS_val' : {0}", fpsvsmasS_val);
Stop();
}
protected override void OnTick()
{
}
protected override void OnStop()
{
}
}
}
@ctrader.guru
ctrader.guru
17 May 2022, 14:56
RE: RE:
trend_meanreversion said:
trend_meanreversion said:
Can someone please show me how to send text from cBot to twitter ? I tried TweetInvi as per instructions in below forum conversation but it doesn't seem to work.
I have already got all DLLs via nuget in TweetInvi 4.0 and added them via Manage references in cAutomate. There is no error while building/compiling cBot but it doest work / post tweets (doesn't give any error) as required.
Can someone please help ?
-TRMR
To provide more information on my issue:
1) Downloaded https://www.nuget.org/packages/TweetinviAPI/ v4.0.3 . Unzipped it and got dll files .
2) Used dll files inside "\lib\netstandard2.0" folder and added them via 'Manage References' in cAutomate.
3) Added using Tweetinvi ; ( at top of my code ) and tried to compile
3) Got error Error CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
** To remove above error: Manually edited the .csproj file and adding the reference. <Reference Include="netstandard" />
3) The I had below lines essentially in my code
using Tweetinvi ; ( at top of my code )
Auth.SetUserCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret"); // In onStart() function
// I have checked access token/secret, consumer token/secret and provided read, write and direct message permissions via https://developer.twitter.com/
4) Got below error:
Crashed in OnStart with TypeInitializationException: The type initializer for 'Tweetinvi.Auth' threw an exception.
Can't resolve it any further..Pls can someone help ? This is supposed to be very simple to just tweet a text via cBot !!
-TRMR
You have to insert a reference to the netstandard.dll, e.g. I use the 4.8 framework and find the reference in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\netstandard.dll or try finding the library in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\netstandard.dll
@ctrader.guru
ctrader.guru
24 Sep 2021, 15:22
RE:
I investigated and it turns out that with cannot insert or manage unmanaged libraries without a reference, even if I copy the library to the root directory it fails to reference that library.
I finally convinced my client that the best solution was NetMQ, I almost finished the project.
Thanks for your interest.
@ctrader.guru
ctrader.guru
24 Sep 2021, 10:13
RE: RE:
Good morning my friend,
actually I said that I have already loaded ZeroMQ "...I have loaded ZeroMQ..." but I can't reference the library "libzmq.dll" because ZeroMQ depends on this library.
I made some tests with console applications and I have no problem because I can put this library "libzmq.dll" together with ZeroMQ.dll but with cTrader things are complicated, if you are able to make a working example I would be grateful.
Regarding NetMQ I never had problems, in fact I was asking for help only for ZeroMQ because my client needs to work with that specific library.
Thanks again for your reply, the search continues....
@ctrader.guru
ctrader.guru
30 Nov 2024, 19:18 ( Updated at: 30 Nov 2024, 19:19 )
Copiix Copy Trading
Hi,
I recommend you use Copiix to work with cTrader, it is 100% free and it is very complete, you have everything you need.
@ctrader.guru