FO
Information
Username: | Foss |
Member since: | 01 Aug 2015 |
Last login: | 01 Aug 2015 |
Status: | Active |
Activity
Where | Created | Comments |
---|---|---|
Algorithms | 0 | 2 |
Forum Topics | 1 | 0 |
Jobs | 0 | 0 |
Username: | Foss |
Member since: | 01 Aug 2015 |
Last login: | 01 Aug 2015 |
Status: | Active |
Where | Created | Comments |
---|---|---|
Algorithms | 0 | 2 |
Forum Topics | 1 | 0 |
Jobs | 0 | 0 |
This looks good but it does not seem to have a stop loss by default. I've added:
private double pipSize;
private double stopLoss = 3.6;
private double sL;
and then added this to the order method:
if (TrdTp == TradeType.Sell)
{
sL = Symbol.Ask + stopLoss * pipSize;
}
else if (TrdTp == TradeType.Buy)
{
sL = Symbol.Bid - stopLoss * pipSize;
}
int cd_8 = 0;
if (iVol > 0)
{
TradeResult result = ExecuteMarketOrder(TrdTp, Symbol, iVol, Label, sL, 0, 0, "smart_grid");
Is this ok or is there a better way to do this?