So I have come across a back tester for TTM_Squeeze not my code but was wondering if the community can help tweak this below. This is were I found the code from the video link- https://tosindicators.com/indicators/ttm-squeeze-backtester
Original Code below:
Couple of things to insert below: need help with the code
Create:
1. alert when to buy to open is true
2. alert when to sell to close is true
Not sure how this can be done but the code below if true then override the alerts above ? In the image below you can see the purple trades means it was one or the codes below. I hope that makes sense if not let me know..
Send Alerts: to phone/email or forward the message log to txt sms? Would it be possible to send when an alert- buy to open vice verse sell to close? Or
if someone can help me create it in marketwatch and create an alert?
Original Code below:
Code:
input length = 20;
input nk = 1.5;
input nBB = 2.0;
def squeeze = TTM_Squeeze(close, length, nk, nBB).SqueezeAlert;
def EMA13 = ExpAverage(close, 13);
def EMA21 = ExpAverage(close, 21);
def EMA34 = ExpAverage(close, 34);
def bullish = EMA13 > EMA21 and EMA21 > EMA34;
def bearish = EMA13 < EMA21 and EMA21 < EMA34;
def fiveDotSqueeze = Sum(squeeze, 5) == 0;
def bullishSignal = if fiveDotSqueeze and bullish then 1 else 0;
def bearishSignal = if fiveDotSqueeze and bearish then 1 else 0;
def exitBullishTrade = if EMA13 < EMA21 and EMA13[1] >= EMA21[1] then 1 else 0;
def exitBearishTrade = if EMA13 > EMA21 and EMA13[1] <= EMA21[1] then 1 else 0;
AddOrder(OrderType.Buy_To_Open, BullishSignal,Close, 100);
AddOrder(OrderType.Sell_To_Close, high>= entryPrice() + entryPrice()*0.03, entryPrice() + entryPrice()*0.03, 10);
AddOrder(OrderType.Sell_To_Close, exitBullishTrade,Close, 100);
AddOrder(OrderType.Sell_To_Open, bearishSignal,Close, 100);
AddOrder(OrderType.Sell_To_Close, low<= entryPrice() - entryPrice()*0.03, entryPrice() - entryPrice()*0.03, 10);
AddOrder(OrderType.Buy_To_Close, exitBearishTrade,Close, 100);
Couple of things to insert below: need help with the code
Create:
1. alert when to buy to open is true
2. alert when to sell to close is true
Not sure how this can be done but the code below if true then override the alerts above ? In the image below you can see the purple trades means it was one or the codes below. I hope that makes sense if not let me know..
Code:
AddOrder(OrderType.Sell_To_Close, high>= entryPrice() + entryPrice()*0.03, entryPrice() + entryPrice()*0.03, 10);
Code:
AddOrder(OrderType.Sell_To_Close, low<= entryPrice() - entryPrice()*0.03, entryPrice() - entryPrice()*0.03, 10);
Send Alerts: to phone/email or forward the message log to txt sms? Would it be possible to send when an alert- buy to open vice verse sell to close? Or
if someone can help me create it in marketwatch and create an alert?