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.
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.
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.
This state represents high market energy and volatility. It occurs when there is a significant movement in price, often accompanied by high trading volume. The market is active and dynamic, similar to splashing water. This state is determined by the position of the price relative to the Alligator’s mouth and the state of the Alligator’s mouth. For example, if the price is outside the Alligator’s mouth and the Alligator’s mouth is in a “sell” state with the price below the Lips line, it is considered “splashing”. This logic is implemented in the function parse_mouth_bs_state_barpos__water in strategies/standard/jgtstrategiesfunctions250523.lua.
This state indicates a strong trend in the market. The Alligator is “eating” when the price is moving consistently in one direction, with the Alligator’s jaw, teeth, and lips lines well-separated and aligned. This suggests a healthy, trending market. For example, if the price is within the Alligator’s mouth and the Alligator’s mouth is in a “sell” state with the price above the Lips line, it is considered “eating”. This logic is also implemented in the function parse_mouth_bs_state_barpos__water in strategies/standard/jgtstrategiesfunctions250523.lua.
This state signifies low market energy and consolidation. The Alligator is “drowning” when the price is moving sideways, with the Alligator’s lines intertwined or very close together. This indicates a lack of clear direction and low volatility in the market. During this state, traders may find it challenging to identify profitable trading opportunities due to the absence of a clear trend. The market is characterized by indecision and a lack of momentum, making it difficult to predict future price movements. This state often precedes a significant market move, as periods of low volatility are typically followed by periods of high volatility. Therefore, traders should be cautious and prepared for potential market shifts when the Alligator is in the “drowning” state. This expanded description provides a more comprehensive understanding of the “drowning” state and its implications for traders. This logic is implemented in the function parse_mouth_dir_state in strategies/standard/jgtstrategiesfunctions250523.lua.
The interaction between the Alligator Mouth State and the Water State is determined by the positions of the Alligator’s Jaw, Teeth, and Lips lines, as well as the price relative to these lines. Here are the key points to understand their interaction:
🌊 Splashing: This state represents high market energy and volatility. It occurs when there is a significant movement in price, often accompanied by high trading volume. The market is active and dynamic, similar to splashing water. This state is determined by the position of the price relative to the Alligator’s mouth and the state of the Alligator’s mouth. For example, if the price is outside the Alligator’s mouth and the Alligator’s mouth is in a “sell” state with the price below the Lips line, it is considered “splashing”. This logic is implemented in the function parse_mouth_bs_state_barpos__water in strategies/standard/jgtstrategiesfunctions250523.lua.
🐊 Eating: This state indicates a strong trend in the market. The Alligator is “eating” when the price is moving consistently in one direction, with the Alligator’s jaw, teeth, and lips lines well-separated and aligned. This suggests a healthy, trending market. For example, if the price is within the Alligator’s mouth and the Alligator’s mouth is in a “sell” state with the price above the Lips line, it is considered “eating”. This logic is also implemented in the function parse_mouth_bs_state_barpos__water in strategies/standard/jgtstrategiesfunctions250523.lua.
💧 Drowning: This state signifies low market energy and consolidation. The Alligator is “drowning” when the price is moving sideways, with the Alligator’s lines intertwined or very close together. This indicates a lack of clear direction and low volatility in the market. During this state, traders may find it challenging to identify profitable trading opportunities due to the absence of a clear trend. The market is characterized by indecision and a lack of momentum, making it difficult to predict future price movements. This state often precedes a significant market move, as periods of low volatility are typically followed by periods of high volatility. Therefore, traders should be cautious and prepared for potential market shifts when the Alligator is in the “drowning” state. This expanded description provides a more comprehensive understanding of the “drowning” state and its implications for traders. This logic is implemented in the function parse_mouth_dir_state in strategies/standard/jgtstrategiesfunctions250523.lua.
The Alligator’s Mouth State can be in either direction: Sell, Buy, or Neither. The documentation in ALLIGATOR_MOUTH_STATE.md provides an overview of these states and their implications for trading strategies. The functions parse_mouth_dir_state and parse_mouth_bs_state_barpos__water in strategies/standard/jgtstrategiesfunctions250523.lua implement the logic for determining these states. 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.
It is important to note that contradictions can occur when the market is oscillating, as the Alligator’s lines may intertwine or be very close together, making it difficult to determine a clear direction. This is why the “drowning” state is significant, as it indicates a lack of clear direction and low volatility in the market. Traders should be cautious and prepared for potential market shifts during this state. The documentation should make it clear that this is a work in progress and that the logic for determining these states is implemented in the Lua functions mentioned above.
Handling oscillating states in the Alligator Indicator involves understanding the interaction between the Alligator Mouth State and the Water State. Here are some key points to consider:
🐊 Alligator Mouth State: The Alligator’s Jaw, Teeth, and Lips lines are used to determine the mouth state. The possible states are “buy”, “sell”, or “neither”. The mouth state can also be in different phases such as “open”, “closed”, “opening”, or “none”. This logic is implemented in the function parse_mouth_dir_state in strategies/standard/jgtstrategiesfunctions250523.lua.
🌊 Water State: 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 possible values for the Water State include “splashing”, “eating”, “throwing”, “poping”, “entering”, and “switching”. This logic is implemented in the function parse_mouth_bs_state_barpos__water in strategies/standard/jgtstrategiesfunctions250523.lua.
💧 Oscillating States: When the market is oscillating, the Alligator’s lines may intertwine or be very close together, making it difficult to determine a clear direction. This is why the “drowning” state is significant, as it indicates a lack of clear direction and low volatility in the market. Traders should be cautious and prepared for potential market shifts during this state. The documentation in ALLIGATOR_MOUTH_STATE.md provides an overview of these states and their implications for trading strategies.
📝 Documentation: Ensure that the documentation in ALLIGATOR_MOUTH_STATE.md is clear about the interaction between the Alligator Mouth State and the Water State. It should also mention that this is a work in progress and that the logic for determining these states is implemented in the Lua functions mentioned above.
To handle transitions between Alligator states and measure the evolution of the distance between lines and their crossing, we need to consider the following points:
🌊 Splashing: This state represents high market energy and volatility. It occurs when there is a significant movement in price, often accompanied by high trading volume. The market is active and dynamic, similar to splashing water. This state is determined by the position of the price relative to the Alligator’s mouth and the state of the Alligator’s mouth. For example, if the price is outside the Alligator’s mouth and the Alligator’s mouth is in a “sell” state with the price below the Lips line, it is considered “splashing”. This logic is implemented in the function parse_mouth_bs_state_barpos__water in strategies/standard/jgtstrategiesfunctions250523.lua.
🐊 Eating: This state indicates a strong trend in the market. The Alligator is “eating” when the price is moving consistently in one direction, with the Alligator’s jaw, teeth, and lips lines well-separated and aligned. This suggests a healthy, trending market. For example, if the price is within the Alligator’s mouth and the Alligator’s mouth is in a “sell” state with the price above the Lips line, it is considered “eating”. This logic is also implemented in the function parse_mouth_bs_state_barpos__water in strategies/standard/jgtstrategiesfunctions250523.lua.
💧 Drowning: This state signifies low market energy and consolidation. The Alligator is “drowning” when the price is moving sideways, with the Alligator’s lines intertwined or very close together. This indicates a lack of clear direction and low volatility in the market. During this state, traders may find it challenging to identify profitable trading opportunities due to the absence of a clear trend. The market is characterized by indecision and a lack of momentum, making it difficult to predict future price movements. This state often precedes a significant market move, as periods of low volatility are typically followed by periods of high volatility. Therefore, traders should be cautious and prepared for potential market shifts when the Alligator is in the “drowning” state. This logic is implemented in the function parse_mouth_dir_state in strategies/standard/jgtstrategiesfunctions250523.lua.
To measure the evolution of the distance between lines and their crossing, we should look back at least 2 to 3 periods. This is evident from the conditions in the parse_mouth_dir_state function in strategies/standard/jgtstrategiesfunctions250523.lua, where the function checks the positions of the Alligator’s Jaw, Teeth, and Lips lines over the last 2 to 3 periods to determine the state.
graph TD;
A[Alligator Mouth State] -->|Buy| B[Water State];
A -->|Sell| C[Water State];
A -->|Neither| D[Water State];
B -->|Splashing| E[Market State];
B -->|Eating| F[Market State];
B -->|Throwing| G[Market State];
B -->|Poping| H[Market State];
B -->|Entering| I[Market State];
B -->|Switching| J[Market State];
C -->|Splashing| K[Market State];
C -->|Eating| L[Market State];
C -->|Throwing| M[Market State];
C -->|Poping| N[Market State];
C -->|Entering| O[Market State];
C -->|Switching| P[Market State];
D -->|Splashing| Q[Market State];
D -->|Eating| R[Market State];
D -->|Throwing| S[Market State];
D -->|Poping| T[Market State];
D -->|Entering| U[Market State];
D -->|Switching| V[Market State];
graph TD;
A[Alligator Mouth State] -->|Open| B[Water State];
A -->|Closed| C[Water State];
A -->|Opening| D[Water State];
A -->|None| E[Water State];
B -->|Splashing| F[Market State];
B -->|Eating| G[Market State];
B -->|Throwing| H[Market State];
B -->|Poping| I[Market State];
B -->|Entering| J[Market State];
B -->|Switching| K[Market State];
C -->|Splashing| L[Market State];
C -->|Eating| M[Market State];
C -->|Throwing| N[Market State];
C -->|Poping| O[Market State];
C -->|Entering| P[Market State];
C -->|Switching| Q[Market State];
D -->|Splashing| R[Market State];
D -->|Eating| S[Market State];
D -->|Throwing| T[Market State];
D -->|Poping| U[Market State];
D -->|Entering| V[Market State];
D -->|Switching| W[Market State];
E -->|Splashing| X[Market State];
E -->|Eating| Y[Market State];
E -->|Throwing| Z[Market State];
E -->|Poping| AA[Market State];
E -->|Entering| AB[Market State];
E -->|Switching| AC[Market State];
classDiagram
class AlligatorMouthState {
+String buy
+String sell
+String neither
+String open
+String closed
+String opening
+String none
}
class WaterState {
+String splashing
+String eating
+String throwing
+String poping
+String entering
+String switching
}
AlligatorMouthState <|-- WaterState