CustomSymbol
interface cAlgo.API Since 5.3
DesktopCLICloud
Represents a custom symbol.
Environment behaviour
CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.
Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.
Definition
public interface CustomSymbol
Namespace: cAlgo.API · Group: Custom
Examples
var customSymbol = CustomSymbols.Add("MYEURUSD", Symbols.GetSymbol("EURUSD"));
customSymbol.Description = "EURUSD copy with custom quotes";
customSymbol.TickDigits = 5;
customSymbol.PipDigits = 4;
customSymbol.BarsNeeded = args => args.CustomBars.AppendBars(MarketData.GetBars(args.CustomBars.TimeFrame, "EURUSD")
.Select(bar => new CustomBar(bar.OpenTime, bar.Open, bar.High, bar.Low, bar.Close, (long)bar.TickVolume)));
customSymbol.UpdateQuote(1.08500, 1.08520);
from System import Action
customSymbol = api.CustomSymbols.Add("MYEURUSD", api.Symbols.GetSymbol("EURUSD"))
customSymbol.Description = "EURUSD copy with custom quotes"
customSymbol.TickDigits = 5
customSymbol.PipDigits = 4
customSymbol.BarsNeeded = Action[CustomSymbolBarsNeededArgs](lambda args: api.Print(f"Bars needed for {args.CustomBars.TimeFrame}"))
customSymbol.UpdateQuote(1.08500, 1.08520)
Methods
| Name | Description |
|---|---|
AddBarsDesktopCLICloudCustomBars | Adds bars for a time frame that will be used for this custom symbol. |
GetBarsDesktopCLICloudCustomBars | Returns bars of a time frame if exists otherwise null. |
RemoveAllUnloadedBarsDesktopCLICloudvoid | Removes all existing unloaded custom bars that aren't being used. |
RemoveBarsDesktopCLICloudbool | Removes bars of a time frame which has no user. |
UpdateQuoteDesktopCLICloudvoid | Updates current symbol quotes. |
Properties
| Name | Description |
|---|---|
AdministrativeChargeDesktopCLIClouddouble | Gets symbol administrative charge. Administrative fee will be charged instead of SWAP if account is marked as SWAP free. Only applicable for SWAP free trading accounts. |
AdministrativeCharge3DaysRolloverDesktopCLICloudDayOfWeek? | Gets / sets the Day of the week (in UTC) when Administrative Fee charge amount will be tripled. Only applicable for SWAP free trading accounts. |
AskDesktopCLIClouddouble | Gets the current ask price for this symbol. |
BarsNeededDesktopCLICloudAction<CustomSymbolBarsNeededArgs> | Gets / sets BarsNeeded handler, it's triggered when bars are needed for a time frame of current custom symbol. |
BaseAssetDesktopCLICloudAsset | Gets / sets the symbol base asset. |
BidDesktopCLIClouddouble | Gets the current bid price for this symbol. |
CommissionDesktopCLIClouddouble | Gets / sets the amount of base commission for the symbol. |
CommissionTypeDesktopCLICloudSymbolCommissionType | Gets / sets the symbol base commission calculation type. |
DescriptionDesktopCLICloudstring | Gets / sets symbol description. |
DynamicLeverageDesktopCLICloudICollection<CustomSymbolLeverageTier> | Gets / sets the symbol dynamic leverage. |
FuturesSettingsDesktopCLICloudCustomSymbolFuturesSettings | Gets / sets custom future contract settings. |
GracePeriodDesktopCLICloudint | Gets / sets symbol grace period. This is the number of days free of Administrative fee from the time of opening a position. Only applicable for SWAP free trading accounts. |
IdDesktopCLICloudlong | Gets the custom symbol ID. |
LotSizeDesktopCLICloudlong | Gets / sets the lot size. |
MarketHoursDesktopCLICloudCustomSymbolMarketHours | Gets / sets the symbol market hours. |
MinCommissionDesktopCLIClouddouble | Gets / sets the minimum amount of commission for the symbol. This is the amount of commission that will be paid by trader for any trade. Check MinCommissionType for interpretation of MinCommission value. |
MinCommissionAssetDesktopCLICloudAsset | Gets / sets the symbol minimum commission asset. If MinCommissionType is set to Asset then you can use this property to get that asset. The MinCommission value will be converted from MinCommissionAsset to account deposit asset at the moment of trade. |
MinCommissionTypeDesktopCLICloudSymbolMinCommissionType | Gets / sets the symbol minimum commission type. Use this property to interpret MinCommission value. |
MinDistanceTypeDesktopCLICloudSymbolMinDistanceType | Gets / sets the symbol minimum distances type. |
MinStopLossDistanceDesktopCLIClouddouble | Gets / sets symbol minimum stop loss distance. Use MinDistanceType for interpretation. |
MinTakeProfitDistanceDesktopCLIClouddouble | Gets / sets symbol minimum take profit distance. Use MinDistanceType for interpretation. |
NameDesktopCLICloudstring | Gets custom symbol unique name. |
PipDigitsDesktopCLICloudint | Gets / sets the symbol pip digits. |
PnLConversionFeeRateDesktopCLIClouddouble | Gets / sets the symbol profit and loss conversion fee rate. |
QuoteAssetDesktopCLICloudAsset | Gets / sets the symbol quote asset. |
SentimentDesktopCLICloudCustomSymbolSentiment | Gets custom symbol sentiment. |
Swap3DaysRolloverDesktopCLICloudDayOfWeek? | Gets / sets the Day of the week when Symbol SWAP charge amount will be tripled. |
SwapCalculationTypeDesktopCLICloudSymbolSwapCalculationType | Gets / sets the symbol SWAP calculation type. |
SwapLongDesktopCLIClouddouble | Gets / sets the SWAP charge for long positions of the symbol. |
SwapPeriodDesktopCLICloudint | Gets / sets symbol swap period. This is the number of days free of Administrative fee from the time of opening a position. |
SwapShortDesktopCLIClouddouble | Gets / sets the SWAP charge for short positions of the symbol. |
SwapTimeInMinutesDesktopCLICloudint | Gets / sets the SWAP time in minutes. |
SymbolDesktopCLICloudSymbol | Gets regular Symbol. |
TickDigitsDesktopCLICloudint | Gets / sets the symbol tick digits. |
VolumeInUnitsMaxDesktopCLIClouddouble | Gets / sets the maximum units value. |
VolumeInUnitsMinDesktopCLIClouddouble | Gets / sets the minimum units value. |
VolumeInUnitsStepDesktopCLIClouddouble | Gets / sets the step volume in units. |
WeekendSwapsDesktopCLICloudbool | Gets / sets whether swap is charged on weekends or not. |
Events
| Name | Description |
|---|---|
BarsUnloadedDesktopCLICloudAction<CustomSymbolBarsUnloadedEventArgs> | Occurs when a custom bars is unloaded and not being used anymore. |
NewChartDesktopCLICloudAction<CustomSymbolNewChartEventArgs> | Occurs when user opens a new chart of current custom symbol. |