|
In today’s blog I want to introduce one of the most important concepts in the script. The code goes like this.**
//approximate 4 hour BB breakout
if (High[0]>= BLG_U[0](Close, 80, 2)) then
buysellzone=-1
lastBreakPrice=high[1]
endif
if (Low[0]<= BLG_L[0](Close, 80, 2)) then
buysellzone=1
lastBreakPrice=low[1]
endif
I feel it’s one of the most significant parts because it calls on those global variables we assigned earlier and allows you to hold a specific condition until another definable condition is meat regardless of what happed between. With most scripts, the whole statement is either true or false, but with these the condition can be false but as long as the second condition isn’t meet then you can keep a value assigned to the global variable. Here’s an example of what I am talking about. ** Let’s say you wanted to buy if RSI, Slow K became oversold in the last 24 hours and the PSAR supports a long. In regular statements unless all three conditions were meet at exactly the same time the statement not evaluate as true. But using these tyope of stamen the value can be held true even if the three conditions happened independently of eachother , but were true sometime in the last 24 hours. Using this example, the following script produced absolutely no trades.**
if RSI[0](Close, 14) < 30 and
SlowK[0](Close,14, 3, 3) < 20 and
SAR[0](Close, 0.02, 0.2) < Close then
addbuyentry
endif

However, by creating a buy/sell zones you can handle this instance and find trades based on the criteria involved. **
global rs
if LLV(RSI[0](Close, 14), 24) < 30 and
LLV(SlowK[0](Close, 14, 3, 3), 24) < 20 then rs = 1
else
rs = 0
endif
if rs = 1 and
SAR[0](Close, 0.02, 0.2) < Close[0] then
addbuyentry
endif
if isbuyposition and Close[0] < SAR[0](Close, 0.02, 0.2) then
addbuyexit
endif
With the change of looking for a 24 hr zone in which to Buy, the There are plenty of buying opportunities.**

In the Larger script, we wanted a buy/ sell zones if the 80 Bollinger Band was broken, meaning we were in overbought or oversold conditions, and then we wanted to move on to further considerations. Let’s see who can send me the sell side of this script first. If you are the first one and it executes in the reverse of the buy, then I ‘ll send you a set of scripts that use in my trading.**
|