Posts (page 71)
-
9 min readThe Aroon indicator is a technical indicator used in swing trading to identify trends and potential market reversals. It consists of two lines; the Aroon up line measures the strength of the uptrend, while the Aroon down line measures the strength of the downtrend. By analyzing the interaction between these lines, traders can make decisions about when to enter or exit trades.
-
7 min readIn Groovy, you can print the attributes of a class using the println statement. Here is an example: class Person { String name = "John" int age = 30 } def person = new Person() println person.name println person.age In the above code, we have a Person class with two attributes: name and age. We create an instance of the class person and then use the println statement to print the values of the attributes.
-
3 min readTo get the size of properties in Groovy, you can use the size() method. The size() method is a built-in method in Groovy that can be used to retrieve the size of a collection or array, including properties. Here is an example: class Person { String name int age } def person = new Person(name: 'John', age: 25) def propertySize = person.properties.
-
11 min readPrice Rate of Change (ROC) is a powerful technical indicator that can be used for swing trading strategies. It helps traders identify when a particular stock's price is accelerating or decelerating. Here are some ways to use ROC for swing trading:Understanding Price Momentum: ROC measures the percentage change in price over a specific time frame, typically expressed as a percentage. By calculating the ROC, traders can gauge the strength of the current price movement.
-
3 min readTo append elements to an array in Groovy, you can use the .plus() method or the += operator. Here's an example: def myArray = ['apple', 'banana', 'cherry'] myArray = myArray.plus('orange') // or myArray += 'orange' println myArray Output: [apple, banana, cherry, orange] In the example above, we start with an array containing three elements. By using the .plus() method or += operator, we append the string 'orange' to the array.
-
7 min readThe Stochastic Oscillator is a popular technical analysis tool used by traders and investors to assess the momentum and strength of a financial instrument. It helps identify potential buying or selling opportunities in the market.The Stochastic Oscillator focuses on the relationship between a security's closing price and its price range over a specific period of time, typically 14 periods.
-
6 min readPattern matching in Groovy script can be done using regular expressions. Regular expressions are sequences of characters that define a search pattern, allowing you to match and manipulate strings based on specific patterns.To perform pattern matching in Groovy, you can use the =~ operator along with regular expression patterns. Here is an example that demonstrates pattern matching in a Groovy script: def text = "Hello, World.
-
4 min readIn Groovy, accessing the Java primitive int type is straightforward as Groovy directly supports Java types.
-
10 min readThe Triangular Moving Average (TMA) is a technical analysis indicator used in financial markets to smooth out price fluctuations and identify trends. It is a variation of the simple moving average (SMA) and provides a more accurate representation of the average price over a specific period.Unlike the SMA, which gives equal weight to all data points in the calculation, the TMA assigns more weight to the recent data points and less weight to the older ones.
-
3 min readTo extract attribute id from an XML file using Groovy, you can use the XmlSlurper class provided by Groovy. Here's how you can do it:First, import the necessary classes: import groovy.util.XmlSlurper Load the XML file: def xml = new XmlSlurper().parse('path/to/your/file.xml') Use dot notation or indexing to access the attribute value: def idValue = xml.elementName.
-
13 min readBollinger Bands are a popular technical analysis tool used by traders to assess the volatility and potential price movements of a financial instrument. They consist of three lines plotted on a price chart, typically representing a moving average line in the center, and two standard deviation lines above and below the moving average.To use Bollinger Bands effectively, traders primarily look for three main aspects:Volatility assessment: Bollinger Bands provide a measure of market volatility.
-
7 min readIn Groovy, an immutable class, by definition, means that the state of the object cannot be modified after its creation. However, Groovy introduces some flexibility with regards to immutability.By default, Groovy classes are mutable, which means that the properties of an object can be changed. This is in contrast to languages like Java, where immutability is enforced by default. Groovy allows modifications to properties even in classes that are declared as "immutable".