OPEN-SOURCE SCRIPT
Bollinger Bands Simple Strategy

This is a simple Bollinger Bands mean-reversion strategy
It works like this:
BUY when price closes below the lower Bollinger Band
SELL when price closes above the upper Bollinger Band
It only opens one trade at a time because pyramiding = 0
Once a trade is open, it manages risk with:
a dynamic stop loss based on the most recent swing low/high plus an ATR buffer
a target at the Bollinger middle band (basis, the 20 SMA)
So the logic is:
long trades expect price to move back up toward the middle band
short trades expect price to move back down toward the middle band
The chart also shows:
the basis as a blue line
the upper and lower bands
an orange stop loss line
a light-green target line
BUY/SELL markers on entry
exit labels when a trade closes
One important detail: the stop loss and target are dynamic, so they update every bar while the trade is open. That means the stop can trail as price moves.
In simple terms, this strategy is trying to catch short-term reversals after price stretches too far outside the Bollinger Bands, then exit when price returns to the middle.
It works like this:
BUY when price closes below the lower Bollinger Band
SELL when price closes above the upper Bollinger Band
It only opens one trade at a time because pyramiding = 0
Once a trade is open, it manages risk with:
a dynamic stop loss based on the most recent swing low/high plus an ATR buffer
a target at the Bollinger middle band (basis, the 20 SMA)
So the logic is:
long trades expect price to move back up toward the middle band
short trades expect price to move back down toward the middle band
The chart also shows:
the basis as a blue line
the upper and lower bands
an orange stop loss line
a light-green target line
BUY/SELL markers on entry
exit labels when a trade closes
One important detail: the stop loss and target are dynamic, so they update every bar while the trade is open. That means the stop can trail as price moves.
In simple terms, this strategy is trying to catch short-term reversals after price stretches too far outside the Bollinger Bands, then exit when price returns to the middle.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.