Ameritrade ThinkorSwim ThinkScript Study Modification
$250-750 USD
In Progress
Posted almost 8 years ago
$250-750 USD
Paid on delivery
I have a study created in ThinkorSwim (Ameritrade) and would like to modify the study so it alerts once and resets. Currently the study sends and audible alert as well as a visual alert in the message center, continuously, until the condition is no longer valid. I'd also like the alert to activate the SMS/Email in the Application Settings somehow, to alert once as well. You must have or download the ThinkorSwim platform in order to test. Testing will not be available on my platform for security reasons. Below is the current script.
_________________________________________________________
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 5;
input percentKLength = 13;
input trailType = {default modified, unmodified};
input ATRPeriod = 144;
input ATRFactor = 7;
input firstTrade = {default long, short};
input averageType = [login to view URL];
Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);
def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
def HRef = if low <= high[1]
then high - close[1]
else (high - close[1]) - 0.5 * (low - high[1]);
def LRef = if high >= low[1]
then close[1] - low
else (close[1] - low) - 0.5 * (low[1] - high);
def trueRange;
switch (trailType) {
case modified:
trueRange = Max(HiLo, Max(HRef, LRef));
case unmodified:
trueRange = TrueRange(high, close, low);
}
def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod);
def state = {default init, long, short};
def trail;
switch (state[1]) {
case init:
if (!IsNaN(loss)) {
switch (firstTrade) {
case long:
state = [login to view URL];
trail = close - loss;
case short:
state = [login to view URL];
trail = close + loss;
}
} else {
state = [login to view URL];
trail = [login to view URL];
}
case long:
if (close > trail[1]) {
state = [login to view URL];
trail = Max(trail[1], close - loss);
} else {
state = [login to view URL];
trail = close + loss;
}
case short:
if (close < trail[1]) {
state = [login to view URL];
trail = Min(trail[1], close + loss);
} else {
state = [login to view URL];
trail = close - loss;
}
}
def BuySignal = Crosses(state == [login to view URL], 0, [login to view URL]);
def SellSignal = Crosses(state == [login to view URL], 0, [login to view URL]);
def TrailingStop = trail;
def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;
def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);
def atrTrailingStop = atrTrailingStop;
def SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
def AvgSMI = expaverage(smi, percentDLength);
def SELL = ((avgsmi > over_bought) and state == [login to view URL]);
def BUY = ((avgsmi < over_sold) and state == [login to view URL]);
Alert(SELL, "SELL", [login to view URL], [login to view URL]);
Alert(BUY, "BUY", [login to view URL], [login to view URL]);
I have read the details of your project. I will do the work the way you want it. I am expert for this project because I have worked on many same as this project. I got enough skill to maintain it. You do not need to be worried about the project. I am 100% good fit for this and I will complete it as the way you expect it..
My name is Mike and I’m from UK. I work with individual clients and also provide outsourcing services for a number of UK and USA based agencies. Your project description sounds interesting to me and I do have skills & experience that is required to complete this project. I can show you some examples of my work. Please contact me to discuss your project.
Hello Sir,
We are an Indian development company here.
we have checked your posted details here and want more clarification in it, so message us to discuss on it more then we will able to move on it.
Thanks