AIS Probabilistic Price Levels MT5
This script allows selecting the TakeProfit and StopLoss levels. It analyzes the history data, and then calculates the probability of reaching a given price level.
How the script works
Suppose you have a trading strategy and you want to select the TakeProfit and StopLoss levels. Run the script and set the parameter:
- Number of Bars - the average position holding time in bars.
Once the script operation is complete, the AIS-PPL.csv file will be created in the Files folder in the terminal data catalog. The PCT column shows the probability (in percents) of price deviation from the entry points by the umber of points indicated in the LVL column.
When selecting the TakeProfit and StopLoss levels, it is necessary to strive to fulfill the following conditions:
- PCT_tp >= PCT_sl
- PCT_tp * LVL_tp >= PCT_sl * LVL_sl.
Assuming V = PCT_tp / (PCT_tp + PCT_sl), the most optimal case is when the equation V * (V * LVL_tp - (1 - V) * LVL_sl) tends to a maximum.
These optimal values are displayed in the Alert box once the script operation is complete.