Topics
Replies
Spotware
27 Jan 2014, 10:04
The difference is that the old API methods are using asynchronous execution whereas ExecuteMarketOrder uses synchronous execution.
If you want to compare the two you can use ExexcuteMarketOrderAsync which uses asynchronous execution. Bear in mind that if you used OnPositionOpened with Trade.CreateBuyMarketOrder, you will have to define a callback method for ExecuteMarketOrderAsync that will be invoked when the position opens.
For instance:
protected override void OnStart() { ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "My Label", OnExecuted); } private void OnExecuted(TradeResult result) { if (result.IsSuccessful) { Print("Position created entry price: {0}", result.Position.EntryPrice); } else { Print("Failed to create position"); } }
Please read /forum/whats-new/1937 as well as /api/guides/trading_api for more information.
@Spotware
Spotware
26 Jan 2014, 11:23
We do not have plans to support inheritance of Parameters from base class. As a workaround you can declare parameter in base class as virtual property and override it in the inherited class.
Base class:
public class BaseCBot : Robot { [Parameter(DefaultValue = 10)] public virtual double Parameter { get; set; }
Inherited class:
public class NewcBot : BaseCBot { [Parameter()] public override double Parameter { get; set; }
@Spotware
Spotware
25 Jan 2014, 20:38
Since now cBots and indicators can be loaded from .algo files only. Please recompile your algorithms using cAlgo.
It is still possible to reference custom .dll files from your algorithms.
Now we are preparing integration with Visual Studio in the native way. You will be able to execute “Edit in Visual Studio” command from context menu of cBot or Indicator.
We apologize for any inconvenience.
@Spotware
Spotware
28 Jan 2014, 11:09
To be able to receive email at the opening of each new position you would have to subscribe an event that is triggered on opening of a new position:
Then use code similar to that example to send a notification in the subscribed event:
@Spotware