Topics
Replies
freemoniescapital
19 Oct 2022, 17:15
Hi Panagiotis,
Appreciate your response and apologies for the late reply. If I understand correctly, is the following code correct?
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 TEST : Robot
{
protected override void OnStart()
{
PRINTINGCLASS printingClass = new(this);
printingClass.Print(this);
}
protected override void OnTick()
{
}
protected override void OnStop()
{
}
public class PRINTINGCLASS
{
public PRINTINGCLASS(Algo algo)
{
algo.Print("Hello");
}
public void Print(Algo algo)
{
algo.Print("Hello");
}
}
}
}
Is there a way to do this without having to pass Algo as a method argument?
Thanks!
@freemoniescapital
freemoniescapital
18 Oct 2022, 14:00
Thanks for your reply
Hi,
Thanks for your reply. Do you have an example on how to implement this? Do you mean creating an instance of the mainclass within the subclass and using the 'ref' keyword? My apologies because I am not strong in C#. Thanks a lot.
@freemoniescapital
freemoniescapital
25 Oct 2022, 09:00
RE: RE:
Hi pick,
I think this works. Thank you so much :)
pick said:
@freemoniescapital