I'm trying to put up or down arrows on the chart if certain conditions are met. Here's the code that I'm having trouble with:
plot Arrow = if (ConnersRSI <= UnderSold) then Arrow = (Arrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP)) else if (ConnersRSI => OverBought) then Arrow = (Arrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN));
Think Script just gives me Invalid Statement. I took the form of the if statement right out of the TOS reference area.
Can anybody help get? Again, thanks in advance for the help.
AFAIK, you'll want to use addOrder() to add up/down arrows. But first a bit on your question about the invalid statement. When using plot Data = x, the x needs to resolve to a numeric value otherwise we couldn't plot it. For a very simplistic possibly even silly illustration, if we wanted to plot a 1 every time the close exceeded the open price and 0 if it didn't, we could write:
Note how the value assigned to Data is numeric (1 or 0);
Now for for putting arrows on the chart, the AddOrder() function offers that. The ConnorsRSI isn't built into TOS so I found an implementation online and modified it for use as a strategy and not a plot. We use the appropriate AddOrders with conditions for overbought buy and sell. I created this as a strategy (not a study) and then ran a strategy report on FB for the last year (daily) and it made 115 orders with total Profit/Loss of $2075. I also used the standard convention from other strategies where up arrows indicate a long entry (aka buy) and down arrows a short entry (aka sell). Hope that helps
The following user says Thank You to jeremyis for this post:
jeremyis already gave you a great reply, way above my pay grade. But for those browsing who are more TS newbie than I am, the thread title suggests something simpler might be on offer. So here are some simplistic answers to your question.
Last edited by tangerine; August 24th, 2015 at 05:59 PM.