sell if price>x or sell if price<y
#1
Information 
I know a minimal amount of coding and I'm basically trying to set up simultaneous stop loss and take profit orders. So for example, if the price of BTC becomes higher than 9500 USDT, I want to market sell my BTC position. Likewise, if it drops to below 8500, I also wanna sell it at market price as well. I want to keep my position as long as the price stays in this range. The below code I attempted to use gives the 'child process has dies' error. What's wrong with it? Can somebody help?

var strat = {};

// Prepare everything our strat needs
strat.init = function() {
  // setting take profit price
  this.proPrice = 9500;

  // setting stop loss price
  this.losPrice = 8500;
}

strat.check = function(candle) {
    if(candle.close <= this.losPrice) {
        this.advice(“short”);
        return;
    }
    if(candle.close >= this.proPrice) {
        this.advice(“short”);
        return;
    }
}

module.exports = strat;
  Reply


Messages In This Thread
sell if price>x or sell if price<y - by MoneyNeverSleeps - 05-01-2018, 05:43 PM

Forum Jump:


Users browsing this thread: