Hi. What code would you use to sell after the price has gone up sharply (out of ordinary) and is about to retrace? I use If Close – Close[n] > X but I wonder what other people use.
Yes, you will have to compare “n” candles’ closing/highest/lowest prices or ranges, i.e.:
// n = number of lookback candles
// PipLimit = number of pips to be considered as a sudden surge
//
// check CLOSING prices
IF (close - close[n]) * pipsize > PipLimit THEN //check if BULLish surge of at least ... pips
IF (close[n] - close) * pipsize > PipLimit THEN //check if BEARish surge of at least ... pips
// or chech HIGHs/LOWs
IF (high - high[n]) * pipsize > PipLimit THEN //check if BULLish surge of at least ... pips
IF (low[n] - low) * pipsize > PipLimit THEN //check if BEARish surge of at least ... pips
// or check RANGEs
IF (range - range[n]) * pipsize > PipLimit THEN //check if BULLish surge of at least ... pips
IF (range[n] - range) * pipsize > PipLimit THEN //check if BEARish surge of at least ... pips
Everyone has his own way of measuring a spike, there’s no guarantee that one of them is the best.
Roberto