Click here to Login





                                                   Better Plotting for Sell Arrows on Chart

  1

0
Dave W.
2013-11-07 19:31:38


Hi. In evaluating some trading systems, I'd like to be able to show realistic buy and sell conditions on a chart. For example, please look at the following script I'm currently using on a chart:

// Buy
Rule1 = Cross(RSI_Threshold, RSI(2));
Rule2 = (close) >= (sma(SMA_Length));
buy = (Rule1) && (Rule2);

// Sell
Rule4 = cross( (RSI(2)) , (RSI_Exit_Level) );
sell = (Rule4);

// Plot Arrows
PlotArrow(Buy, "", BelowLow, colorGreen);
PlotArrow(Sell, "", AboveHigh, colorRed);

The issue is, the code above plots too many buy and sell arrows. I want the ability to only plot a buy arrow when I wouldn't already be in a position, and only a single sell arrow when I am in a position and exiting. Is there a way to achieve that on a chart using a script?

Let me know if you'd like to see a screen shot to get a better sense of what I mean and I can post one somewhere.

Thank you.





QuantShare
2013-11-08 19:39:24

  3

Best Answer
Add the following lines just before "PlotArrow" funtion:

buy = RemoveSameSignals(buy, sell);
sell = RemoveSameSignals(sell, buy);




No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Relative Performance/Return Chart - Compare Several Assets/Stocks...
Relative Performance/Return Chart - Compare Several Assets/Stocks
High to low stock pattern for the close price
Put/Call Ratio for Individual Stocks
Market Cap Historical Data for the US Stock Market

How-to Lessons
How to plot arrows below/above candlesticks on a chart
How to display two stocks on the same chart
How to plot two different time frames in the same chart
How to add a trading indicator to a chart
How to print a chart

Related Forum Threads
Buy Sell Signals Chart Layout
Chart for 1m bars over a custom time range
Plotting text on a chart
A button in chart for drawing item
Custom index/relative chart for TAA - Sector rotation

Blog Posts
How to get buy and sell orders for a portfolio based on a trading...
How to download the history of dividend payments for stocks in th...
How to Backtest a Strategy from a Chart
Different Ticker Symbols for Each Data Source
How to Select the Best Market Indicator for your Trading System









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.