//BUYING PART!!
if (!invested && symbolData.Factor >= 3 && symbolData.LowestAverage >= price) // && _btc > _minPosition
{
if (symbolData.MacdChange >= 0 & symbolData.MacdChange < 2)//&& symbolData.MacdChange < 2
{
//PLACING ORDER
var quantity = NormalizeQuantity(symbol, btcAmount / data[symbol].Close);

if (quantity == 0) continue;

MarketOrder(symbol, quantity);

Plot("Trades", "AANKOOP", price);
Debug($"Aankoop: {symbol} {data[symbol].Price} ter waarde van {usdAmount}"); // Als het order gemaakt is word dit bevestigd door de debug
Notify.Email("david.wittevronghel@gmail.com", "TradeAlert",$"Gekocht {symbol} op {data[symbol].Price}");

Log($"prijs {price} en Max 24uur {symbolData.MaxExchange} en MIN 24uur {symbolData.MinExchange}");
symbolData.TargetPrice = price * (1 + _targetPercent); //DETERMINE WICH SELLING PRICE WHEN PROFIT.
symbolData.StopPrice = price * (1 - _stopPercent); //DETERMINE WICH SELLING PRICE WHEN LOSS.

}
}

//SELLING PART!!
if (invested)
{
if (price >= symbolData.TargetPrice)
{

Debug($"Verkoop Winst: {symbol} {data[symbol].Price}"); // Als het order gemaakt is word dit bevestigd door de debug
Plot("BTC", "Holdings", Portfolio.CashBook["BTC"].Amount);
Plot("Trades", "VERKOOP WINST \n", price);

var tag = $"+1% WINST VERKOCHT {symbol} op {data[symbol].Price}";
// Alex: let's tag the order instead of adding to the logs

LimitOrder(symbol,-symbolData.Holding, symbolData.TargetPrice);

//Liquidate(symbol, tag);
//MarketOrder(symbol, -symbolData.Holding);

//Log(tag);
//Notify.Email("...@gmail.com", "TradeAlert", tag);
}
if (price < symbolData.StopPrice)
{

Debug($"Verkoop Verlies: {symbol} {data[symbol].Price}"); // Als het order gemaakt is word dit bevestigd door de debug
Plot("BTC", "Holdings", Portfolio.CashBook["BTC"].Amount);
Plot("Trades", "VERKOOP VERLIES \n", price);

var tag = $"-10% VERLIES VERKOCHT {symbol} op {data[symbol].Price}";
// Alex: let's tag the order instead of adding to the logs

LimitOrder(symbol,-symbolData.Holding, symbolData.StopPrice);

//Liquidate(symbol, tag);
//MarketOrder(symbol, -symbolData.Holding);

//Log(tag);
//Notify.Email("...@gmail.com", "TradeAlert", tag);
}
}

 

I have several types of sell orders. (Liquidate,, MarketOrder)

But the problem with Liquidate or Marketorder is when I want 1% profit with the Targetprice the order isn't sold with 1% profit. Mostly it is less than 1%.

And also the exchange fee is 0.2% taker fee and 0.1% maker fee. 

But now I want a LimitOrder cause then the order will only be executes when the Targetprice or Stopprice is reached. 

 

My question is now: is the LimitOrder inplemented correctly for both sell orders?

 

Thanks in advance,

 

David