Topics
27 Jun 2018, 21:31
 0
 2143
 4
28 Aug 2017, 18:39
 1883
 2
18 Aug 2017, 13:17
 4067
 8
Replies

nakw
11 Apr 2025, 21:02 ( Updated at: 14 Apr 2025, 05:18 )

you maybe need to send ProtoOAApplicationAuthReq payloadType 2100 first with clientId,clientSecret
 

server response:

{ payloadType: 2101, protoType: 'ProtoOAApplicationAuthRes' }


@nakw

nakw
11 Apr 2025, 20:51 ( Updated at: 14 Apr 2025, 05:17 )

i know this is old, but for anyone, you can get account list using http api like this one:

https://api.spotware.com/connect/tradingaccounts?access_token=your_accessToken
 

json example:


{  "data": [    
{ "accountId": 11111, // use this for ctidTraderAccountId
"accountNumber": 22222, // your account number in ctrader
"live": true,
"brokerName": “xxxx”,
"brokerTitle": "Raw Trading Ltd",
"depositCurrency": "USD",
"traderRegistrationTimestamp": ...,
"traderAccountType": "HEDGED",
"leverage": 1000,
"leverageInCents": 100000,
"balance": 3616,
"deleted": false,
"accountStatus": "ACTIVE",
"swapFree": false,
"moneyDigits": 2
},
....
]
}

not sure if this official and ok to be used or not but it save time to get acc list and their ids.


@nakw

nakw
22 Jun 2018, 20:53

What you ask for is not clear.

 

but if you want martingale to check if last trade was lose then use "History"

 

 

var p= History.FindLast("Label",Symbol);
var isLose = (p != null && p.Pips<0);

if(isLose)
{
// do something
}

 


@nakw

nakw
29 May 2018, 19:24

for me the 3.0 is more light than 2.x

and used less ram than before


@nakw

nakw
29 May 2018, 18:55

im calgo coder and i liked the new version two in one. also i liked the new API need to test them more later

problems i see in calgo is if you have too much cbot/indicator projects this will slow down and take more RAM

because every project have its own/chart window

you can make it more light with single chart window and when someone switch project load the new chart?

thanks for the update and keep it up.

 

 

 

 


@nakw

nakw
28 Aug 2017, 18:47

oh sorry the bug is in my eyes .. i didnt sort it correctly by closing time ..

you can please close this topic ..


@nakw

nakw
09 Aug 2017, 08:38

 var DailyOpen = Daily.OpenTime.GetIndexByTime(MarketSeries.OpenTime[0]);

this line used index 0 for OpenTime

index 0 means first bar in history of your TimeFrame

 

you need to use last index or before last  -> here i use last one not current open one

var DailyOpen = Daily.OpenTime.GetIndexByTime(MarketSeries.OpenTime.Last(1));

 for current open bar use 0: 

MarketSeries.OpenTime.Last(0);

if you want  to see is last bar a Green or Red bar 

Close - Open = +1 or -1

var dframe=MarketData.GetSeries(TimeFrame.Daily);
if(dframe.Close.Last(1)-dframe.Open.Last(1) > 0)
{
 // last Daily Bar is Green
}else{
 // last Daily Bar is Red
}

do your tests

 

gl


@nakw

nakw
03 Aug 2017, 00:37

i see there is no option for closingPrice .. but here is a way give you the close or "near" close price

Change = pips * Symbol.PipSize , so the 5pips will be 0.0005 based on symbol

if trade is sell:  reverse the Change like this: Change = ( Change - ( Change * 2 ) ) 

EntryPrice + Change = ClosePrice

Code For Test:

var entryPrice = position.EntryPrice;
var change = (position.TradeType == TradeType.Buy ? position.Pips : position.Pips - (position.Pips * 2)) * Symbol.PipSize;
var closePrice = entryPrice + change;
Print(entryPrice.ToString("0.0000") + " " + change.ToString("0.0000") + " " + closePrice.ToString("0.0000"));
     

 

GL ..


@nakw