Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I'm struggling to learn this code.. Trying to convert my very simple watchlist script into a radar screen function of easy language. This is the code if anyone can help out maybe it will start to click after this I am hoping. Thanks in advance.
def isBull = dmiplus > dmiminus and dmiplus[1] <= dmiminus[1];
def isBear = dmiplus < dmiminus and dmiplus[1] >= dmiminus[1];
plot PlotBull = if isBull then 1 else if isBear then -1 else 0;
PlotBull.assignValueColor(if isBull then color.UPTICK else if isBear then color.DOWNTICK else CreateColor(237, 237, 237));
assignBackgroundColor(if isBull then color.UPTICK else if isBear then color.DOWNTICK else CreateColor(237, 237, 237));
Can you help answer these questions from other members on NexusFi?
Here's a simple indicator based on your tos code. I don't have experience with radarscreen so you might need to add a few function calls to change the cell colors, etc. If you really need it, I can try. Let me know.
Hope this helps,
-C
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
I think I am getting close.. It seems to work but what I was hoping for was only indicate for a current crossing otherwise the cell should be white.. Anyway this is what I have. I am struggling with if the cell isn't 1 or -1 I am wanting it to be white or black(just not setting a color if there is no cross). I hope this makes sense. Thanks again
Im looking for someone who knows how to code that could help me with this. I need this converted from thinkscript to easy language. Any help is much appreciated. Thanks in advance.
# sdi_psarstgy:
#hint:Strategy to evaluate trading parabolic-stop-and-reverse signals http://ww1.smalldoginvestor.com/?usid=24&utid=7393946367 rev:1.1.0
# author: allen everhart
# date: 16may2014
# revisions:
# 4jun2014-added %win label, corrected reverse price on gaps
input dollarsPerTrade = 10000;
#hint dollarsPerTrade: trades vary in share size in order to keep the invested dollars constant to create a fair comparison to passive strategies. http://ww1.smalldoginvestor.com/?usid=24&utid=7393946367 rev: 1.1.0
input accelerationFactor = 0.02;
#hint accelerationFactor: controls how steep a parabola is traced by the stop.
input accelerationLimit = 0.2;
#hint accelerationLimit: after the limit is reached the stop moves up in a straight line.
def psar = ParabolicSAR( "acceleration limit" = accelerationLimit, "acceleration factor" = accelerationFactor);
def buySig = close crosses above psar;
def sellSig = close crosses below psar;
def shareSize = round(dollarsPerTrade/psar,0) ;
def buyPrice=#psar;
if open[-1]>psar then open[-1]
else psar;
def sellPrice= #psar;
if open[-1]<psar then open[-1]
else psar;
AddOrder(OrderType.BUY_AUTO, buySig[-1], price = buyPrice, tradeSize=shareSize, name = "buy");
AddOrder(OrderType.SELL_AUTO, sellSig[-1], price = sellPrice, tradeSize=shareSize, name="short");
plot parSAR = psar;
parsar.setPaintingStrategy(paintingStrategy.POINTS);
parSar.setDefaultColor(color.rED);
def longPrice=compoundValue(1,
if !longPrice[1] && buySig[-1] then buyPrice
else if longPrice[1] && sellSig[-1] then 0
else longPrice[1]
,0
);
#plot lp=longPrice;
def shortPrice=compoundValue(1,
if !shortPrice[1] && sellSig[-1] then sellPrice
else if shortPrice[1] && buySig[-1] then 0
else shortPrice[1]
,0
);
#plot sp=shortPrice;
def wincntr= compoundValue(1,
if longPrice[1] && sellSig[-1] && sellPrice>longPrice[1] then wincntr[1]+1
else if shortPrice[1] && buySig[-1] && shortPrice[1]>buyPrice then wincntr[1]+1
else wincntr[1]
,0
);
def winNum=if isnan(wincntr) then winNum[1] else wincntr ;
def losscntr= compoundValue(1,
if longPrice[1] && sellSig[-1] && sellPrice<=longPrice[1] then losscntr[1]+1
else if shortPrice[1] && buySig[-1] && shortPrice[1]<=buyPrice then losscntr[1]+1
else losscntr[1]
,0
);
def lossNum=if isnan(lossCntr) then lossNum[1] else lossCntr ;