Click here to Login





                                                   Question on Swing Point function sp()

  0

0
Obuli Govindaraju
2012-07-29 15:08:37


I have a question on the swing point function sp() at this link http://www.quantshare.com/item-1121-swing-point-function-sp

As per the description the second parameter can be negative. If it is negative then the value returned by the function is positive if that particular sequence swing is swing high and negative otherwise.

so I tried the following code below on a security.

outputlist(sp(3,1)." , ".sp(3,-1));

sp(3,1) correctly returns the value which is a swing low (and returns as positive number). However I was expecting to see negative value returned for sp(3,-1) instead it returns the value of sp(3,0).

Am I missing something?



SystemTrade
2012-07-29 18:33:42

  0

Best Answer
Hi Obuli,

sp(3, 0) returns the price level of last swing point, but from that information alone you do not see whether it is a swing high or low.
sp(3, 1) returns the price level of the swing point before, and you will know that this is a swing high if sp(3, 0) was a swing low and vice versa.
sp(3, -1) returns the price level of the LAST swing point with a positive sign if this is a swing high and negative in case of a swing low. It only works for the LAST swing point, because if you know whether the last one is high or low, you automatically know the sign of the swing point before.
If you want to see the sign on every swing point, just modify the last line of the code from "return(TA.Iff(point < 0, sti, TA.Absolute(sti)));" to "return(sti);"

Hope this helps.



Obuli Govindaraju
2012-07-29 20:13:35

  0

Thanks for the quick reply.

I think I get it now. The problem is that how you define term "Last Swing point". You are defining the last swing point as the one currently developing where as I define it as the one that is developed.

Strictly speaking you dont even need this negative value parameter as if I simply compare sp(3,0) with sp(3,1) I can easily determine which one is swing low/high.




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
Swing Point Function (SP)
Swing Trading Indicator (STI)
Accumulation Swing Index
Swing Simulation
Pivot Point Breakout Scanner

How-to Lessons
How to display two stocks on the same chart
How to detect stocks trading near all time highs
How to plot arrows below/above candlesticks on a chart
How to use the Fibonacci retracement drawing tool
How to create a hatched area in a chart

Related Forum Threads
sp() function
Interpretation of " DRAWDOWNEQ" function
TimeframeApply function
Composite Function
Problem with performance calculation in custom function

Blog Posts
How to create market indicators using the composite function - Pa...
The 'inside period' function
How to create market indicators using the composite function - Pa...
How to create market indicators using the composite function - Pa...
Getting Accurate Backtesting Results: Survivorship bias-free S&P ...









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 2021 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.