Topics
Replies

firemyst
03 Jul 2023, 03:44

RE:

sadiqbashir14 said:

We need more customized indicators, especially useful indicators like fluidetrades in the tradingview and many others.

Then

1) look for them in the repository:

2) write them yourself

3) ask in the indicator forum if there's someone willing to do it for you

4) or contact someone like @PanagiotisChar or @ClickAlgo who will have them developed for you for a cost.


@firemyst

firemyst
02 Jul 2023, 08:00

 

 


@firemyst

firemyst
02 Jul 2023, 07:58

Adding a link to your suggestion for others to vote on this feature:

 


@firemyst

firemyst
30 Jun 2023, 17:46

How do you even know it's getting past this to enter trades?

 

if (!istimecorrect)
                    return;

 

????

 

You need to put Print statements to see if it even gets past that return statement.


@firemyst

firemyst
30 Jun 2023, 17:24

//Try this
if (Account.MarginLevel.HasValue && Account.MarginLevel >= MarginRequirement)
  //execute your order
}
else
{
    if (!Account.MarginLevel.HasValue)
        Print("Margin Level has no value.");
    else
       //print out your margin levels so you can actually see what it is
       Print("Margin Level is {0}", Account.MarginLevel);
}

 


@firemyst

firemyst
30 Jun 2023, 09:42

RE: RE:

AlexFrei said:

 

Hi Firemyst, thank you so much !! I didnt know about History collection. Great. Thanks ! Have a great day

 

No worries. That's what the forums are for :-)


@firemyst

firemyst
30 Jun 2023, 03:33

You can do it in a position closing event method. Rough example below:

 

//In the OnStart method:
Positions.Closed += Positions_Closed;


//In the method itself once the event is defined:
private void Positions_Closed(PositionClosedEventArgs args)
{
     Position p1 = args.Position;
    //do whatever you have to do

    //Now get the historical trade stuff.
    HistoricalTrade ht = History.FindLast(p1.Label, p1.SymbolName, p1.TradeType);
    Print("Position \"{0} {1}\" closed for reason \"{2}\" with {3} profit. Entry Price {4}, Closing Price {5}, StopLoss {6}, ClosingTime {7}", p1.Id, p1.Label, args.Reason, String.Format("{0:$#,###.00}", p1.GrossProfit), p1.EntryPrice, p1.ClosingPrice, p1.StopLoss, ht.ClosingTime);

    //finish off whatever you have to do
}

 


@firemyst

firemyst
29 Jun 2023, 03:43

This suggestion is already here if you'd vote on it instead of starting another thread and splitting votes:

 


@firemyst

firemyst
29 Jun 2023, 03:41

How about posting this "help" question in the forum where it belongs?

 


@firemyst

firemyst
28 Jun 2023, 06:54

In regards to your second point, why aren't you testing margin levels in your code _before_ sending the execute order? Your margin levels change dynamically, and the order execution isn't always instantaneous.

For instance, you could have margin level of 50% when you submit the order, but then price in another open position of yours drops, lowering your margin level below 50%, which means your order can no longer execute even though it had enough margin when you submitted the order.

//You should check your account's margin levels before sending the order
//just to be a bit safer
if (Account.MarginLevel.HasValue && Account.MarginLevel >= xxx)
  //execute your order
}

 


@firemyst

firemyst
27 Jun 2023, 02:31

RE:

philippe.cortellezzi said:

Hello,

It will be great to be able to attach order (limit or stop) to any indicator or object.

Kind regards

It would be great if you'd post this in the suggestion forum where it actually belongs:

 


@firemyst

firemyst
26 Jun 2023, 05:58 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE:

Quant_Vs_Market said:

firemyst said:

JSON works perfectly with cAlgo. I use it in all my bots for saving states.

I'm using the NewtonSoft json package in Visual Studio.

You haven't stated anything on how you have your VS configured (if you're using it), nor any sample code reproducing your issue.

 

It simply says package "netwonsoft.json" is not supported, same thing with entityframework. so i reckon its blocked due to some reason. i am running .Net6.0, but i already removed these packages, i resorted to saving notepad files separated by random characters ;(

I suspect it may have something to do with the way it's been imported?

See with mine:

and it's a .Net 6.0 bot too:

and it's local to my machine when I add a reference in cTrader itself (make sure to do that instead of trying to add a reference in Visual Studio itself)

 

 


@firemyst

firemyst
26 Jun 2023, 05:30

JSON works perfectly with cAlgo. I use it in all my bots for saving states.

I'm using the NewtonSoft json package in Visual Studio.

You haven't stated anything on how you have your VS configured (if you're using it), nor any sample code reproducing your issue.

 


@firemyst

firemyst
24 Jun 2023, 17:42

Vote:

 

 


@firemyst

firemyst
24 Jun 2023, 17:41

Use "args.Reason" to find the reason a position was closed.

 

 private void OnPositionsClosed(PositionClosedEventArgs args)
        {
         Print("Closed for reason {0}", args.Reason);
        }

 


@firemyst

firemyst
24 Jun 2023, 17:35

This is a super basic feature - why is it not incorporated into the mobile version yet? This is 2023!


@firemyst

firemyst
24 Jun 2023, 17:33

And a dark theme that's customizable and NOT based on whether the phone is set to a dark theme. Other apps like Google Maps, web browser, and such allow users to switch between dark/light theme manually independent of how the phone is set.


@firemyst

firemyst
24 Jun 2023, 17:30

Would love to see this in cTrader. Should be native like it is with Trading View.


@firemyst

firemyst
24 Jun 2023, 17:19

This is a multistep process:

 

1) create a global variable that counts the number of crossovers.

private int _maCrossOverCount;

2) In the OnStart method, set the count to zero:

_maCrossOverCount = 0;

3) Every time a cross over happens, increase the count by 1. However, you have to decide if you want the cross over to count if it happens when a "tick" comes in or a new bar. Reason being is obviously if the MA's are close, they could cross over hundreds of time within a bar on every tick depending on how much price fluctuates

if (_sma1.Result.LastValue > _sma2.Result.LastValue)
            {
              _maCrossOverCount += 1;



//and


if (_sma1.Result.LastValue < _sma2.Result.LastValue)
            {
              _maCrossOverCount += 1;

 

 

4) Check the crossover count before you open a position:

if (_maCrossOverCount > 1)

{

   /// code what you need to in order to open your position

}


@firemyst

firemyst
24 Jun 2023, 05:32

Someone can correct me if I'm wrong, but the PRC is retrofitted to price action. Only the current value of the PRC is not repainted. This is similar to a linear regression channel which is also retrofitted to price action. This means that the entire graph is repainted, with the exception of the current value of the channel, which can be used for an automated strategy.

This has already been discussed somewhat here:

https://ctrader.com/forum/ctrader-support/37573#:~:text=Hi%2C,it's%20retrofitted%20to%20price%20action.

 

 


@firemyst