Here is my attempt to put together a multi time-frame parabolic sar indicator using my copy-and-paste coding ability . I had some trouble trying to get it to do a few things so if someone could jump in and give a hand, that would be great. If anyone has anything to add or whatever, please feel free.

If three or more of the time frame is above the psar then the MTF PSAR line (top line #6) is green otherwise it will be red. The candles are colored the same as this line.

I've actually posted the wrong indicator which is actually the MTF ATR Trailing Stop indicator. I've updated the post to reflect the MTF Parabolic SAR indicator.

MTF PSAR for time-based charts...

Ok, nobody seems to know how to come up with a MTF indicator for tick and range charts and the consensus among thinkscripters is that tick and range charts does not support "multi time-frames". Well, I've figured out a way to do that with some functionality. It does have some limitations in that you cannot specify the exact tick. However, the "multi time-frames" will be a multiple of the current tick/range chart. So if you are using a 100 tick chart then a multiplier of 5 would mean a 500 tick chart. And if you were on a 5-range chart, a multiplier of 5 would mean a 25-range "time -frame". I did try to see if the same indicator can be used on both time-based and tick/range-based charts by using a multiple of the time (ie: 1min x 60 = 1hour), but it doesn't quite come out right. So you just have to us the correct indicator for the specific type of chart for now. I'm not a coder (at best copy and paste) so if anyone can improve this, please feel free. This template could be used to applied to other indicators to support "multi-tick/range" charts.

Here it is. MTF PSAR for tick/range charts...

If three or more of the time frame is above the psar then the MTF PSAR line (top line #6) is green otherwise it will be red. The candles are colored the same as this line.

*** EDITED ***I've actually posted the wrong indicator which is actually the MTF ATR Trailing Stop indicator. I've updated the post to reflect the MTF Parabolic SAR indicator.

MTF PSAR for time-based charts...

Code:

```
# Multi time-frame Parabolic SAR indicator by tradegeek.
# Master PSAR line(top line, #6) is green when 3+ of the 5 time-frames are cyan and red when 3+ of the 5 time-frame are magenta.
# MTF_PSAR
declare lower;
input TimeFrame1 = AggregationPeriod.MIN;
input TimeFrame2 = AggregationPeriod.TWO_MIN;
input TimeFrame3 = AggregationPeriod.FIVE_MIN;
input TimeFrame4 = AggregationPeriod.TEN_MIN;
input TimeFrame5 = AggregationPeriod.FIFTEEN_MIN;
input PaintBars = {default "yes", "no"};
def close1 = Close(Period = TimeFrame1);
def close2 = Close(Period = TimeFrame2);
def close3 = Close(Period = TimeFrame3);
def close4 = Close(Period = TimeFrame4);
def close5 = Close(Period = TimeFrame5);
def low1 = Low(Period = TimeFrame1);
def low2 = Low(Period = TimeFrame2);
def low3 = Low(Period = TimeFrame3);
def low4 = Low(Period = TimeFrame4);
def low5 = Low(Period = TimeFrame5);
def high1 = High(Period = TimeFrame1);
def high2 = High(Period = TimeFrame2);
def high3 = High(Period = TimeFrame3);
def high4 = High(Period = TimeFrame4);
def high5 = High(Period = TimeFrame5);
input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");
##### Chart Time-frame (Time-frame 1)
def state = {default init, long, short};
def extreme;
def SAR;
def acc;
switch (state[1]) {
case init:
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = low;
case short:
if (SAR[1] < high)
then {
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = extreme[1];
} else {
state = state.short;
if (low < extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = low;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
}
case long:
if (SAR[1] > low)
then {
state = state.short;
acc = accelerationFactor;
extreme = low;
SAR = extreme[1];
} else {
state = state.long;
if (high > extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = high;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
}
}
##### Time-frame 2
def state2 = {default init, long, short};
def extreme2;
def SAR2;
def acc2;
switch (state2[1]) {
case init:
state2 = state2.long;
acc2 = accelerationFactor;
extreme2 = high2;
SAR2 = low2;
case short:
if (SAR2[1] < high2)
then {
state2 = state2.long;
acc2 = accelerationFactor;
extreme2 = high2;
SAR2 = extreme2[1];
} else {
state2 = state2.short;
if (low2 < extreme2[1])
then {
acc2 = min(acc2[1] + accelerationFactor, accelerationLimit);
extreme2 = low2;
} else {
acc2 = acc2[1];
extreme2 = extreme2[1];
}
SAR2 = max(max(high2, high2[1]), SAR2[1] + acc2 * (extreme2 - SAR2[1]));
}
case long:
if (SAR2[1] > low2)
then {
state2 = state2.short;
acc2 = accelerationFactor;
extreme2 = low2;
SAR2 = extreme2[1];
} else {
state2 = state2.long;
if (high2 > extreme2[1])
then {
acc2 = min(acc2[1] + accelerationFactor, accelerationLimit);
extreme2 = high2;
} else {
acc2 = acc2[1];
extreme2 = extreme2[1];
}
SAR2 = min(min(low2, low2[1]), SAR2[1] + acc2 * (extreme2 - SAR2[1]));
}
}
##### Time-frame 3
def state3 = {default init, long, short};
def extreme3;
def SAR3;
def acc3;
switch (state3[1]) {
case init:
state3 = state3.long;
acc3 = accelerationFactor;
extreme3 = high3;
SAR3 = low3;
case short:
if (SAR3[1] < high3)
then {
state3 = state3.long;
acc3 = accelerationFactor;
extreme3 = high3;
SAR3 = extreme3[1];
} else {
state3 = state3.short;
if (low3 < extreme3[1])
then {
acc3 = min(acc3[1] + accelerationFactor, accelerationLimit);
extreme3 = low3;
} else {
acc3 = acc3[1];
extreme3 = extreme3[1];
}
SAR3 = max(max(high3, high3[1]), SAR3[1] + acc3 * (extreme3 - SAR3[1]));
}
case long:
if (SAR3[1] > low3)
then {
state3 = state3.short;
acc3 = accelerationFactor;
extreme3 = low3;
SAR3 = extreme3[1];
} else {
state3 = state3.long;
if (high3 > extreme3[1])
then {
acc3 = min(acc3[1] + accelerationFactor, accelerationLimit);
extreme3 = high3;
} else {
acc3 = acc3[1];
extreme3 = extreme3[1];
}
SAR3 = min(min(low3, low3[1]), SAR3[1] + acc3 * (extreme3 - SAR3[1]));
}
}
##### Time-frame 4
def state4 = {default init, long, short};
def extreme4;
def SAR4;
def acc4;
switch (state4[1]) {
case init:
state4 = state4.long;
acc4 = accelerationFactor;
extreme4 = high4;
SAR4 = low4;
case short:
if (SAR4[1] < high4)
then {
state4 = state4.long;
acc4 = accelerationFactor;
extreme4 = high4;
SAR4 = extreme4[1];
} else {
state4 = state4.short;
if (low4 < extreme4[1])
then {
acc4 = min(acc4[1] + accelerationFactor, accelerationLimit);
extreme4 = low4;
} else {
acc4 = acc4[1];
extreme4 = extreme4[1];
}
SAR4 = max(max(high4, high4[1]), SAR4[1] + acc4 * (extreme4 - SAR4[1]));
}
case long:
if (SAR4[1] > low4)
then {
state4 = state4.short;
acc4 = accelerationFactor;
extreme4 = low4;
SAR4 = extreme4[1];
} else {
state4 = state4.long;
if (high4 > extreme4[1])
then {
acc4 = min(acc4[1] + accelerationFactor, accelerationLimit);
extreme4 = high4;
} else {
acc4 = acc4[1];
extreme4 = extreme4[1];
}
SAR4 = min(min(low4, low4[1]), SAR4[1] + acc4 * (extreme4 - SAR4[1]));
}
}
##### time-frame 5
def state5 = {default init, long, short};
def extreme5;
def SAR5;
def acc5;
switch (state5[1]) {
case init:
state5 = state5.long;
acc5 = accelerationFactor;
extreme5 = high5;
SAR5 = low5;
case short:
if (SAR5[1] < high5)
then {
state5 = state5.long;
acc5 = accelerationFactor;
extreme5 = high5;
SAR5 = extreme5[1];
} else {
state5 = state5.short;
if (low5 < extreme5[1])
then {
acc5 = min(acc5[1] + accelerationFactor, accelerationLimit);
extreme5 = low5;
} else {
acc5 = acc5[1];
extreme5 = extreme5[1];
}
SAR5 = max(max(high5, high5[1]), SAR5[1] + acc5 * (extreme5 - SAR5[1]));
}
case long:
if (SAR5[1] > low5)
then {
state5 = state5.short;
acc5 = accelerationFactor;
extreme5 = low5;
SAR5 = extreme5[1];
} else {
state5 = state5.long;
if (high5 > extreme5[1])
then {
acc5 = min(acc5[1] + accelerationFactor, accelerationLimit);
extreme5 = high5;
} else {
acc5 = acc5[1];
extreme5 = extreme5[1];
}
SAR5 = min(min(low5, low5[1]), SAR5[1] + acc5 * (extreme5 - SAR5[1]));
}
}
##### Plots
plot PSAR = if IsNaN(SAR) then Double.NaN else 1;
PSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR.SetLineWeight(lineWeight = 3);
PSAR.DefineColor("Buy", GetColor(0));
PSAR.DefineColor("Sell", GetColor(1));
PSAR.AssignValueColor(if state == state.long
then PSAR.Color("Sell")
else PSAR.Color("Buy"));
plot PSAR2 = if IsNaN(SAR2) then Double.NaN else 2;
PSAR2.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR2.SetLineWeight(lineWeight = 3);
PSAR2.DefineColor("Buy", GetColor(0));
PSAR2.DefineColor("Sell", GetColor(1));
PSAR2.AssignValueColor(if state2 == state2.long
then PSAR2.Color("Sell")
else PSAR2.Color("Buy"));
plot PSAR3 = if IsNaN(SAR3) then Double.NaN else 3;
PSAR3.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR3.SetLineWeight(lineWeight = 3);
PSAR3.DefineColor("Buy", GetColor(0));
PSAR3.DefineColor("Sell", GetColor(1));
PSAR3.AssignValueColor(if state3 == state3.long
then PSAR3.Color("Sell")
else PSAR3.Color("Buy"));
plot PSAR4 = if IsNaN(SAR4) then Double.NaN else 4;
PSAR4.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR4.SetLineWeight(lineWeight = 3);
PSAR4.DefineColor("Buy", GetColor(0));
PSAR4.DefineColor("Sell", GetColor(1));
PSAR4.AssignValueColor(if state4 == state4.long
then PSAR4.Color("Sell")
else PSAR4.Color("Buy"));
plot PSAR5 = if IsNaN(SAR5) then Double.NaN else 5;
PSAR5.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR5.SetLineWeight(lineWeight = 3);
PSAR5.DefineColor("Buy", GetColor(0));
PSAR5.DefineColor("Sell", GetColor(1));
PSAR5.AssignValueColor(if state5 == state5.long
then PSAR5.Color("Sell")
else PSAR5.Color("Buy"));
def PSAR_TF1 = if state == state.long then 0 else 1;
def PSAR_TF2 = if state2 == state2.long then 0 else 1;
def PSAR_TF3 = if state3 == state3.long then 0 else 1;
def PSAR_TF4 = if state4 == state4.long then 0 else 1;
def PSAR_TF5 = if state5 == state5.long then 0 else 1;
plot MTF_PSAR = 6;
MTF_PSAR.SetPaintingStrategy(PaintingStrategy.SQUARES);
MTF_PSAR.SetLineWeight(lineWeight = 3);
MTF_PSAR.DefineColor("Buy", GetColor(5));
MTF_PSAR.DefineColor("Sell", GetColor(6));
MTF_PSAR.AssignValueColor ( if (PSAR_TF1 + PSAR_TF2 + PSAR_TF3 + PSAR_TF4 + PSAR_TF5) >= 3 then MTF_PSAR.Color("Buy") else MTF_PSAR.Color("Sell"));
AssignPriceColor ( if PaintBars is false and (PSAR_TF1 + PSAR_TF2 + PSAR_TF3 + PSAR_TF4 + PSAR_TF5) >= 3 then MTF_PSAR.Color("Buy") else if PaintBars is false and (PSAR_TF1 + PSAR_TF2 + PSAR_TF3 + PSAR_TF4 + PSAR_TF5) < 3 then MTF_PSAR.Color("Sell") else Color.CURRENT);
```

Ok, nobody seems to know how to come up with a MTF indicator for tick and range charts and the consensus among thinkscripters is that tick and range charts does not support "multi time-frames". Well, I've figured out a way to do that with some functionality. It does have some limitations in that you cannot specify the exact tick. However, the "multi time-frames" will be a multiple of the current tick/range chart. So if you are using a 100 tick chart then a multiplier of 5 would mean a 500 tick chart. And if you were on a 5-range chart, a multiplier of 5 would mean a 25-range "time -frame". I did try to see if the same indicator can be used on both time-based and tick/range-based charts by using a multiple of the time (ie: 1min x 60 = 1hour), but it doesn't quite come out right. So you just have to us the correct indicator for the specific type of chart for now. I'm not a coder (at best copy and paste) so if anyone can improve this, please feel free. This template could be used to applied to other indicators to support "multi-tick/range" charts.

Here it is. MTF PSAR for tick/range charts...

Code:

```
# A multi time frame parabolic sar for tick_count and range charts by tradegeek
# The "tickMultiplier" is a multiple of the current chart. If you're on a 100 tick chart, a multiplier of 1, 5, 10, and 20, would mean a 100 tick, 500 tick, 1000 tick, and 2000 tick chart, respectively.
# MTF_PSAR_TICK
declare lower;
input tickMultiplier1 = 1;
input tickMultiplier2 = 10;
input tickMultiplier3 = 20;
input tickMultiplier4 = 30;
input tickMultiplier5 = 40;
input PaintBars = {default "yes", "no"};
def close1 = Lowest(close,tickMultiplier1);
def close2 = Lowest(close,tickMultiplier2);
def close3 = Lowest(close,tickMultiplier3);
def close4 = Lowest(close,tickMultiplier4);
def close5 = Lowest(close,tickMultiplier5);
def low1 = Lowest(low,tickMultiplier1);
def low2 = Lowest(low,tickMultiplier2);
def low3 = Lowest(low,tickMultiplier3);
def low4 = Lowest(low,tickMultiplier4);
def low5 = Lowest(low,tickMultiplier5);
def high1 = Highest(high,tickMultiplier1);
def high2 = Highest(high,tickMultiplier2);
def high3 = Highest(high,tickMultiplier3);
def high4 = Highest(high,tickMultiplier4);
def high5 = Highest(high,tickMultiplier5);
input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");
##### Chart Time-frame (Time-frame 1)
def state = {default init, long, short};
def extreme;
def SAR;
def acc;
switch (state[1]) {
case init:
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = low;
case short:
if (SAR[1] < high)
then {
state = state.long;
acc = accelerationFactor;
extreme = high;
SAR = extreme[1];
} else {
state = state.short;
if (low < extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = low;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
}
case long:
if (SAR[1] > low)
then {
state = state.short;
acc = accelerationFactor;
extreme = low;
SAR = extreme[1];
} else {
state = state.long;
if (high > extreme[1])
then {
acc = min(acc[1] + accelerationFactor, accelerationLimit);
extreme = high;
} else {
acc = acc[1];
extreme = extreme[1];
}
SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
}
}
##### Time-frame 2
def state2 = {default init, long, short};
def extreme2;
def SAR2;
def acc2;
switch (state2[1]) {
case init:
state2 = state2.long;
acc2 = accelerationFactor;
extreme2 = high2;
SAR2 = low2;
case short:
if (SAR2[1] < high2)
then {
state2 = state2.long;
acc2 = accelerationFactor;
extreme2 = high2;
SAR2 = extreme2[1];
} else {
state2 = state2.short;
if (low2 < extreme2[1])
then {
acc2 = min(acc2[1] + accelerationFactor, accelerationLimit);
extreme2 = low2;
} else {
acc2 = acc2[1];
extreme2 = extreme2[1];
}
SAR2 = max(max(high2, high2[1]), SAR2[1] + acc2 * (extreme2 - SAR2[1]));
}
case long:
if (SAR2[1] > low2)
then {
state2 = state2.short;
acc2 = accelerationFactor;
extreme2 = low2;
SAR2 = extreme2[1];
} else {
state2 = state2.long;
if (high2 > extreme2[1])
then {
acc2 = min(acc2[1] + accelerationFactor, accelerationLimit);
extreme2 = high2;
} else {
acc2 = acc2[1];
extreme2 = extreme2[1];
}
SAR2 = min(min(low2, low2[1]), SAR2[1] + acc2 * (extreme2 - SAR2[1]));
}
}
##### Time-frame 3
def state3 = {default init, long, short};
def extreme3;
def SAR3;
def acc3;
switch (state3[1]) {
case init:
state3 = state3.long;
acc3 = accelerationFactor;
extreme3 = high3;
SAR3 = low3;
case short:
if (SAR3[1] < high3)
then {
state3 = state3.long;
acc3 = accelerationFactor;
extreme3 = high3;
SAR3 = extreme3[1];
} else {
state3 = state3.short;
if (low3 < extreme3[1])
then {
acc3 = min(acc3[1] + accelerationFactor, accelerationLimit);
extreme3 = low3;
} else {
acc3 = acc3[1];
extreme3 = extreme3[1];
}
SAR3 = max(max(high3, high3[1]), SAR3[1] + acc3 * (extreme3 - SAR3[1]));
}
case long:
if (SAR3[1] > low3)
then {
state3 = state3.short;
acc3 = accelerationFactor;
extreme3 = low3;
SAR3 = extreme3[1];
} else {
state3 = state3.long;
if (high3 > extreme3[1])
then {
acc3 = min(acc3[1] + accelerationFactor, accelerationLimit);
extreme3 = high3;
} else {
acc3 = acc3[1];
extreme3 = extreme3[1];
}
SAR3 = min(min(low3, low3[1]), SAR3[1] + acc3 * (extreme3 - SAR3[1]));
}
}
##### Time-frame 4
def state4 = {default init, long, short};
def extreme4;
def SAR4;
def acc4;
switch (state4[1]) {
case init:
state4 = state4.long;
acc4 = accelerationFactor;
extreme4 = high4;
SAR4 = low4;
case short:
if (SAR4[1] < high4)
then {
state4 = state4.long;
acc4 = accelerationFactor;
extreme4 = high4;
SAR4 = extreme4[1];
} else {
state4 = state4.short;
if (low4 < extreme4[1])
then {
acc4 = min(acc4[1] + accelerationFactor, accelerationLimit);
extreme4 = low4;
} else {
acc4 = acc4[1];
extreme4 = extreme4[1];
}
SAR4 = max(max(high4, high4[1]), SAR4[1] + acc4 * (extreme4 - SAR4[1]));
}
case long:
if (SAR4[1] > low4)
then {
state4 = state4.short;
acc4 = accelerationFactor;
extreme4 = low4;
SAR4 = extreme4[1];
} else {
state4 = state4.long;
if (high4 > extreme4[1])
then {
acc4 = min(acc4[1] + accelerationFactor, accelerationLimit);
extreme4 = high4;
} else {
acc4 = acc4[1];
extreme4 = extreme4[1];
}
SAR4 = min(min(low4, low4[1]), SAR4[1] + acc4 * (extreme4 - SAR4[1]));
}
}
##### time-frame 5
def state5 = {default init, long, short};
def extreme5;
def SAR5;
def acc5;
switch (state5[1]) {
case init:
state5 = state5.long;
acc5 = accelerationFactor;
extreme5 = high5;
SAR5 = low5;
case short:
if (SAR5[1] < high5)
then {
state5 = state5.long;
acc5 = accelerationFactor;
extreme5 = high5;
SAR5 = extreme5[1];
} else {
state5 = state5.short;
if (low5 < extreme5[1])
then {
acc5 = min(acc5[1] + accelerationFactor, accelerationLimit);
extreme5 = low5;
} else {
acc5 = acc5[1];
extreme5 = extreme5[1];
}
SAR5 = max(max(high5, high5[1]), SAR5[1] + acc5 * (extreme5 - SAR5[1]));
}
case long:
if (SAR5[1] > low5)
then {
state5 = state5.short;
acc5 = accelerationFactor;
extreme5 = low5;
SAR5 = extreme5[1];
} else {
state5 = state5.long;
if (high5 > extreme5[1])
then {
acc5 = min(acc5[1] + accelerationFactor, accelerationLimit);
extreme5 = high5;
} else {
acc5 = acc5[1];
extreme5 = extreme5[1];
}
SAR5 = min(min(low5, low5[1]), SAR5[1] + acc5 * (extreme5 - SAR5[1]));
}
}
##### Plots
plot PSAR = if IsNaN(SAR) then Double.NaN else 1;
PSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR.SetLineWeight(lineWeight = 3);
PSAR.DefineColor("Buy", GetColor(0));
PSAR.DefineColor("Sell", GetColor(1));
PSAR.AssignValueColor(if state == state.long
then PSAR.Color("Sell")
else PSAR.Color("Buy"));
plot PSAR2 = if IsNaN(SAR2) then Double.NaN else 2;
PSAR2.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR2.SetLineWeight(lineWeight = 3);
PSAR2.DefineColor("Buy", GetColor(0));
PSAR2.DefineColor("Sell", GetColor(1));
PSAR2.AssignValueColor(if state2 == state2.long
then PSAR2.Color("Sell")
else PSAR2.Color("Buy"));
plot PSAR3 = if IsNaN(SAR3) then Double.NaN else 3;
PSAR3.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR3.SetLineWeight(lineWeight = 3);
PSAR3.DefineColor("Buy", GetColor(0));
PSAR3.DefineColor("Sell", GetColor(1));
PSAR3.AssignValueColor(if state3 == state3.long
then PSAR3.Color("Sell")
else PSAR3.Color("Buy"));
plot PSAR4 = if IsNaN(SAR4) then Double.NaN else 4;
PSAR4.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR4.SetLineWeight(lineWeight = 3);
PSAR4.DefineColor("Buy", GetColor(0));
PSAR4.DefineColor("Sell", GetColor(1));
PSAR4.AssignValueColor(if state4 == state4.long
then PSAR4.Color("Sell")
else PSAR4.Color("Buy"));
plot PSAR5 = if IsNaN(SAR5) then Double.NaN else 5;
PSAR5.SetPaintingStrategy(PaintingStrategy.POINTS);
PSAR5.SetLineWeight(lineWeight = 3);
PSAR5.DefineColor("Buy", GetColor(0));
PSAR5.DefineColor("Sell", GetColor(1));
PSAR5.AssignValueColor(if state5 == state5.long
then PSAR5.Color("Sell")
else PSAR5.Color("Buy"));
def PSAR_TF1 = if state == state.long then 0 else 1;
def PSAR_TF2 = if state2 == state2.long then 0 else 1;
def PSAR_TF3 = if state3 == state3.long then 0 else 1;
def PSAR_TF4 = if state4 == state4.long then 0 else 1;
def PSAR_TF5 = if state5 == state5.long then 0 else 1;
plot MTF_PSAR = 6;
MTF_PSAR.SetPaintingStrategy(PaintingStrategy.SQUARES);
MTF_PSAR.SetLineWeight(lineWeight = 3);
MTF_PSAR.DefineColor("Buy", GetColor(5));
MTF_PSAR.DefineColor("Sell", GetColor(6));
MTF_PSAR.AssignValueColor ( if (PSAR_TF1 + PSAR_TF2 + PSAR_TF3 + PSAR_TF4 + PSAR_TF5) >= 3 then MTF_PSAR.Color("Buy") else MTF_PSAR.Color("Sell"));
AssignPriceColor ( if PaintBars is false and (PSAR_TF1 + PSAR_TF2 + PSAR_TF3 + PSAR_TF4 + PSAR_TF5) >= 3 then MTF_PSAR.Color("Buy") else if PaintBars is false and (PSAR_TF1 + PSAR_TF2 + PSAR_TF3 + PSAR_TF4 + PSAR_TF5) < 3 then MTF_PSAR.Color("Sell") else Color.CURRENT);
```

Last edited: