JGT Strategies repo
This document provides an overview of the Alligator Mouth State and Water State used in the trading strategy implemented in the jgwill/jgtstrategies repository. These states are determined based on the positions of the Alligator’s Jaw, Teeth, and Lips lines, as well as the price relative to these lines.
Momentum between the lines is measured with the Gator Oscillator while directional bias relies on the Awesome Oscillator (AO) zero line.
The Alligator Mouth State is determined by analyzing the positions of the Alligator’s Jaw, Teeth, and Lips lines. These lines are calculated using the ALLIGATOR indicator. The Jaw, Teeth, and Lips lines are represented by al.Jaw[period], al.Teeth[period], and al.Lips[period] respectively in the code.
Older Lua helpers also emit a closed phase when the lines converge tightly before reversing.
The function parse_mouth_dir_state in strategies/standard/xptoDSPrep231124v5.lua determines the direction and state of the Alligator’s mouth based on these conditions.
The Water State is determined by the position of the price relative to the Alligator’s mouth and the state of the Alligator’s mouth. The function parse_mouth_bs_state_barpos__water in strategies/standard/xptoDSPrep231124v5.lua implements this logic.
parse_mouth_dir_stateThis function determines the direction and state of the Alligator’s mouth based on the positions of the Jaw, Teeth, and Lips lines. It returns the mouth direction (buy, sell, or neither) and the mouth state (open, closed, opening, or none).
parse_mouth_bs_state_barpos__waterThis function determines the position of the price relative to the Alligator’s mouth and the water state. It returns the price mouth position (in or out) and the water state (splashing, eating, throwing, poping, entering, or switching).
signal_alligator_mouth_state_changedThis function handles the change in state of the Alligator’s mouth. It is used to signal when the Alligator’s mouth state changes, which can be used for making trading decisions.
The output values for the Alligator Mouth State and Water State are:
mouth_dir: The direction of the Alligator’s mouth (buy, sell, or neither).mouth_state: The state of the Alligator’s mouth (open, closed, opening, or none).mouth_bar_pos: The position of the price relative to the Alligator’s mouth (in or out).water_state: The water state (splashing, eating, throwing, poping, entering, or switching).These values are essential for making trading decisions based on the Alligator indicator.
See docs/alligator_mouth_water_state_article.md for a detailed article on these indicators.
The Alligator Indicator is a technical analysis tool used to identify market trends and potential reversals. It consists of three lines: the Jaw, Teeth, and Lips.
The Jaw line is a 13-period Smoothed Moving Average (SMMA) shifted by 8 periods into the future. It acts as a support or resistance level.
The Teeth line is an 8-period Smoothed Moving Average (SMMA) shifted by 5 periods into the future. It provides additional confirmation of the trend.
The Lips line is a 5-period Smoothed Moving Average (SMMA) shifted by 3 periods into the future. It is the most sensitive to price changes.
The Alligator Indicator identifies the following states:
The Alligator Indicator also identifies the following phases:
The market is either advancing or not advancing (oscillating). The interaction between the Alligator Mouth State and the Water State involves analyzing the positions of the Alligator’s Jaw, Teeth, and Lips lines, as well as the price relative to these lines. Contradictions can occur when the market is oscillating, making it difficult to determine a clear direction.
For more detailed information, refer to the ALLIGATOR_MOUTH_STATE.md file.