netarchitech
Well-known member
@RobertPayne I'm sure that there will be a number of uTS scripters looking to take advantage of your very generous offer. Thank you
On that note, I was hoping to ask you to take a look at a script I've been working on, when you have a moment. I'm trying to put together a simple trade calculator...
Any pointers/tips would be much appreciated
On that note, I was hoping to ask you to take a look at a script I've been working on, when you have a moment. I'm trying to put together a simple trade calculator...
Rich (BB code):
# filename: _TradeCalculator_
# author: netarchitech
# version: 20181105
def priceC = close;
input averageType = AverageType.WILDERS;
input ATRlength = 10; # default length = 14 - can range anywhere from 6 to 21
input ATRmultiplier = 1.50; # default multiplier = 2.0 - can range anywhere from 1.0 to 5.0
def ATR = MovingAverage(averageType, TrueRange(high, close, low), ATRlength);
def avgDailyMovement = (ATR / priceC) * 100;
input profitMultiplier = 3.00;
input AccountEquity = 100000;
input PercentRiskPerTrade = 0.005;
def EquityRiskPerTrade = AccountEquity * PercentRiskPerTrade;
def SharesToBuy = (EquityRiskPerTrade / (avgDailyMovement * ATRmultiplier));
def currentPositionSize = SharesToBuy * priceC;
def stopAmount = avgDailyMovement * ATRmultiplier;
def longSellStop = priceC - stopAmount;
def shortBuyStop = priceC + stopAmount;
def profitTarget = avgDailyMovement * profitMultiplier;
def longSellLimit = priceC + profitTarget;
def shortBuyLimit = priceC - profitTarget;
AddLabel(yes, "Shares to Buy: " + Round(SharesToBuy, 0), CreateColor (255, 255, 255));
AddLabel(yes, "Position Size: " + AsText(currentPositionSize, NumberFormat.TWO_DECIMAL_PLACES), CreateColor (255, 255, 255));
AddLabel(yes, "LONG Sell STOP: " + AsText(longSellStop, NumberFormat.TWO_DECIMAL_PLACES), CreateColor (255, 255, 255));
AddLabel(yes, "LONG Sell LIMIT: " + AsText(longSellLimit, NumberFormat.TWO_DECIMAL_PLACES), CreateColor (255, 255, 255));
AddLabel(yes, "SHORT Buy STOP: " + AsText(shortBuyStop, NumberFormat.TWO_DECIMAL_PLACES), CreateColor (255, 255, 255));
AddLabel(yes, "SHORT Buy LIMIT: " + AsText(shortBuyLimit, NumberFormat.TWO_DECIMAL_PLACES), CreateColor (255, 255, 255));
Any pointers/tips would be much appreciated