Topics
Replies
fxwisdom1@gmail.com
17 Aug 2018, 10:30
Sorry correction to the code above.
Btw problem still not solved. Kindly help
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class SLhelper : Robot { [Parameter("SL Step Triggers", DefaultValue = 7.0)] public double sl { get; set; } protected override void OnStart() { } protected override void OnTick() { // Put your core logic here } protected override void OnStop() { // Put your deinitialization logic here } void OnPositionsOpened(PositionOpenedEventArgs args) { Print("Hello World"); var position = args.Position; Print(position.Label + " TIDAK ADA"); ModifyPosition(position, position.VolumeInUnits, sl); Print("EROR"); Print("123123"); } void OnPositionsModified(PositionModifiedEventArgs args) { Print("Modified"); } void OnPositionsClosed(PositionClosedEventArgs args) { var position = args.Position; Print("78678678678"); if (position.NetProfit < 0) { var tradeType = position.TradeType; if (tradeType == TradeType.Buy) tradeType = TradeType.Sell; else if (tradeType == TradeType.Sell) tradeType = TradeType.Buy; var symbol = MarketData.GetSymbol(position.SymbolCode); var volume = position.VolumeInUnits; var label = position.Label; ExecuteMarketOrder(tradeType, symbol, volume * 2, label); } } } }
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
30 May 2018, 13:32
RE:
tmc_ said:
I believe you can't. However, you can save the information into comment or expiration time.
DateTime expiration = Time.AddYears(1); string comment = Time.ToString(); TradeResult order = PlaceLimitOrder(TradeType.Buy, Symbol, 1000, 1, "", null, null, expiration, comment); if (order.IsSuccessful) { DateTime orderExpiration = (DateTime)order.PendingOrder.ExpirationTime; DateTime timeFromExpiration = orderExpiration.AddYears(-1); Print("From expiration: " + timeFromExpiration); DateTime timeFromComment = DateTime.Parse(order.PendingOrder.Comment); Print("From comment: " + timeFromComment); }Log:
26/05/2016 18:39:31.984 | cBot "New cBot" was started successfully for EURUSD, h1. 26/05/2016 18:39:32.015 | Placing Limit Order to Buy 1000 EURUSD (Price: 1.00000, ExpireTime: 26/05/2017 18:39:32) 26/05/2016 18:39:32.155 | → Placing Limit Order to Buy 1000 EURUSD (Price: 1.00000, ExpireTime: 26/05/2017 18:39:32) SUCCEEDED, PendingOrder OID18905301 26/05/2016 18:39:32.155 | From expiration: 26/05/2016 18:39:32 26/05/2016 18:39:32.155 | From comment: 26/05/2016 18:39:32 26/05/2016 18:39:32.187 | cBot "New cBot" was stopped for EURUSD, h1.
It's a nice solution but not so elegant. Anyhow, thank you
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
30 May 2018, 13:28
RE:
Panagiotis Charalampous said:
Dear Trader,
You can get the executed deals either by using History in cAlgo.API or using Connect API
Best Regards,
Panagiotis
One more thing, where can I get the Submitted Price from the history?
Thank you
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
30 May 2018, 13:16
RE:
Panagiotis Charalampous said:
Dear Trader,
You can get the executed deals either by using History in cAlgo.API or using Connect API
Best Regards,
Panagiotis
Thanks for the reply.
Kindly explain /api/reference/historicaltrade
What's the difference between positionID and closingDealId?
I can't find OrderId in there
Thank you
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
30 May 2018, 04:48
RE:
Astroke said:
Hi,
Of course you have 220ms and Advanced take profit is not in the server he's client based
* cTrader must be running and connected to the internet for Advanced Stop Loss and Advanced Take Profit to work properly.
So you mean pending orders won't be executed/closed if the cTrader is closed?
Meaning the pending order including take profit and stop loss aren't stored in the server?
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
29 May 2018, 19:57
( Updated at: 21 Dec 2023, 09:20 )
RE:
fxwisdom1@gmail.com said:
Sell Stop order. Volume was 0.32
Submited price 1296.02
Entry price 1293.42
In the screenshot you can see the pending order linked to other order details/sub-windows
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
29 May 2018, 19:06
I have a feedback for cTrader
1. When an order opened, make sure the TARGET ENTRY PRICE is still intact. That way we can calculate the slippage by subtracting the FILL PRICE - TARGET ENTRY PRICE.
In MT4, for example buy stop order at 1.34512 and SL is at 1.34412. stop loss diff is 100 pips
When the order got filled with slippage at 1.35612 and SL is still fixed at 1.34412. stop loss diff is 200
Hence we can calculate the slippage by the stop loss diference. 200-100 which is 100 pips slippage.
So an idea to detect slippage on specific order for cTrader/cAlgo
For example buy stop order at 1.35512 and SL 100 pips.
When the order got filled with slippage at 1.34612 and SL is 100 pips in relative to the filled order. <<< This is fine
But you should put another variable into Positions object.
With that we can calculate the slippage = FILL PRICE - TARGET ENTRY PRICE
1.35512-1.34512 = 100 pips slippage
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
29 May 2018, 18:51
I reckon you should able to install multiple cTrader instances on the PC.
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
29 May 2018, 18:48
RE:
lec0456 said:
Hey, I like the new cTrader but the left side menu bar takes up too much screen realestate. You got put that back on the top or make it moveable to top, bottom or side.
I like it
@fxwisdom1@gmail.com
fxwisdom1@gmail.com
17 Aug 2018, 10:36
Please try the code aboev and place a market order, then modify its SL/TP.
I expect there should be a print out message on the cBot log.
@fxwisdom1@gmail.com