Symbol.GetEstimatedMargin not working

Created at 21 Oct 2023, 08:25
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
R.

r.stipriaan

Joined 05.02.2021

Symbol.GetEstimatedMargin not working
21 Oct 2023, 08:25


Hi,

 

Symbol.GetEstimatedMargin() is not working on most pairs.

The outcome will always be between 0,031 and 0,039. 

for example use “Print (Symbol.GetEstimatedMargin(TradeType.Sell,2000000));” .

 

i think this is a bug or am i doing something wrong? 

 

thanks. 

 


@r.stipriaan
Replies

PanagiotisChar
22 Oct 2023, 06:34

Hi there,

It is better to share a specific example that somebody can easily reproduce. Share the full cBot code, the broker and symbol you are running this code on.

 


@PanagiotisChar

r.stipriaan
22 Oct 2023, 07:21

RE: Symbol.GetEstimatedMargin not working

PanagiotisChar said: 

Hi there,

It is better to share a specific example that somebody can easily reproduce. Share the full cBot code, the broker and symbol you are running this code on.

 

Hi PanagiotisChar,

 

I just found out that Symbol.GetEstimatedMargin() is only not working in backtest. 

 I use this for every currency pair, my broker is pepperstone. 

When i run backtest on the dollar pairs only the outcome of the low leverage 1:20 pairs AUDUSD & NZDUSD is correct. 

 

Code for example: 

 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 NewcBot : Robot
    {

        protected override void OnStart()
        {

            Print (Symbol.GetEstimatedMargin(TradeType.Sell,2000000));
        }

        protected override void OnTick()
        {
        
        }

    }
}

 


@r.stipriaan