Summary

Creates buy/sell market order.

Syntax

CreateMarketOrder(TradeType tradeType, Symbol symbol, int volume)

Parameters

Example

//...
[Parameter]
public DataSeries Source { get; set; }

[Parameter(DefaultValue = 5)]
public int periodfast { get; set; }

[Parameter(DefaultValue = 10)]
public int periodslow { get; set; }

private SimpleMovingAverage smafast;
private SimpleMovingAverage smaslow;

protected override void OnStart()
{
    smafast = Indicators.SimpleMovingAverage(Source, periodfast);
    smaslow = Indicators.SimpleMovingAverage(Source, periodslow);
}
protected override void OnTick()//This could be OnBar() also.
{
    {
        if (smafast.Result.LastValue > smaslow.Result.LastValue)
        {
            Trade.CreateMarketOrder(TradeType.Buy,Symbol, 10000);
        }
    }
}
//...