rc1111
April 21, 2021, 4:36pm
#1
Hi everyone, new to AB and figuring out some basics and stuck on something which I'm sure is simple.
I wanted to set a sell stop at the low of the bar on which the long signal was generated. I used portions of the code found here:
http://www.amibroker.com/kb/2014/10/17/using-price-levels-with-applystop-function/
It works! However, I do not understand why. Specifically the line:
stopLevelLong = Ref( L, -1 ); // use previous bar low
Is that not creating an array? How is the value of "stopLevelLong" only being set on the bar of the buy signal?
On a related note, if I could visualize the arrays, it might be helpful. Is there a way to view the arrays in a data window?
Thanks!
Tomasz
April 21, 2021, 4:41pm
#2
Yes it creates array, but... ApplyStop()
samples the value of the array passed as 'amount' at entry and holds it for how long trade takes, unless you use volatile flag.
http://www.amibroker.com/f?applystop
Visualising arrays and other techiques:
Continuing the discussion from How do I learn AFL? :
Many new users with zero programming experience struggle when their formula works incorrectly. Here are few hints that everyone should use to make finding errors easier.
First of all: you have to get insight into what the formula is actually doing, not what you think it does.
Typically new user has no idea what is happening inside. Pretty often you make an assumption that things work one way but in fact they work differently. Do not assume t…
See also:
and
In addition to regular percent or point based stops, AmiBroker allows to define stop size as risk (stopModeRisk), which means that we allow only to give up certain percent of profit gained in given trade. The picture presented below visualizes a...
Henri
April 22, 2021, 8:41am
#3
You can use the explore function. Think that is what you are looking for....
https://www.amibroker.com/guide/h_exploration.html
1 Like
system
Closed
July 31, 2021, 1:13pm
#5
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.