Hello Everyone
I am new here and new to LUA but am able to program in VB.net. I want to modify ma_advisor with some filters so am trying to understand it and learn LUA at the same time.
I plan to add some price based entry filters, delete the way it auto reverses the position when the crossover happens, and change the way the stop is moved. As it is it whipsaws during consolidation.
I cant find where a check for stop loss or target prices being hit is and I cant see where it moves the stoploss. I hope someone can give a brief explanation of how the stops and targets are managed.
For the trailing stop (long trades) my VB code is
If dayhigh(n) > countbackhigh Then 'we have a new high
countbackhigh = dayhigh(n)
countbacklow = daylow(n)
countcheck = 0
z = 0
Do Until countcheck = 2 'find the last 2 significant lows
If daylow(n - z) < countbacklow Then
countbacklow = daylow(n - z)
countcheck = countcheck + 1
End If
z = z + 1
Loop
If stoploss < countbacklow Then
stoploss = countbacklow
End If
End If
I think this should be easy to implement but I dont understand how the stop is currently moved and checked.
Thanks.