#### ebtrader

##### New member

Here's a great way to use Laguerre for stop placement.

Code:

```
#Laguerre Filter created by TradeScripter
#Enhanced by EBTrader
AssignBackgroundColor(CreateColor(8, 0, 15));
input price = close;
input gamma = 0.2;
rec L0 = (1 - gamma) * price + gamma * L0[1];
rec L1 = -gamma * L0 + L0[1] + gamma * L1[1];
rec L2 = -gamma * L1 + L1[1] + gamma * L2[1];
rec L3 = -gamma * L2 + L2[1] + gamma * L3[1];
def FIlt = (L0 + 2 * L1 + 2 * L2 + L3) / 6;
def FIR = (price + 2 * price[1] + 2 * price[2] + price[3]) / 6;
plot Plot1 = FIlt;
plot Plot2 = FIR;
#Plot1.SetDefaultColor(color.red);
#Plot2.SetDefaultColor(color.blue);
Plot1.AssignValueColor(if Filt > FIlt[1] then Color.GREEN else Color.RED);
Plot2.AssignValueColor(if FIR > FIlt and FIR > FIR[1] then Color.GREEN else if FIR < FIlt and FIR < FIR[1] then Color.RED else Color.WHITE);
#AssignPriceColor(if FIR > FIlt and FIR > FIR[1] then Color.GREEN else if FIR < FIlt and FIR < FIR[1] then Color.RED else Color.WHITE);
```

Last edited: