Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hi, I just started messing around with EasyLanguage. I am just trying to put a small test strategy together for myself just to teach myself how this all works.
So in this example, I am trying to make my target exit price a percentage of the High/Low of the trigger bar.
I created a variables called HLSize which is just high-low, and then I multiply that by 0.25 in order to get 25% of the H/L. But just to make this easier for testing, let's just use the high-low as the amount without multiplying by a percent.
The problem is that it keeps recalculating the high low on every bar and the variable keeps updating. How do I store the high-low value of the trigger bar in a variable, or how do I at least set it as my take profit without it changing on every bar.
Here is my code:
(Note, I removed some stuff just to simplify it for this post, so some of the entry conditions might not make sense.)
Any help is appreciated.
Can you help answer these questions from other members on NexusFi?
Ok, I found a solution, but from a logical standpoint, I don't understand why it should be this way.
Immediately above the 2 IF statements, I put another IF statement with the same criteria, except without the test for the entry direction. Inside there, I put the tgamt=hlsize.
This works, but I'm still curious as to why I should have to do it this way. putting the tgamt=hlsize should do the same thing if I put it in the 2 IF staements.
Hi, thanks for the help.
It was getting set to 0, but that was in the initial declaration of my variables. The way I understand this, is that TS basically runs the script once per bar. So I guess my issue is that i need a way to store a value without it being reset on each instance the script is run. I thought that I did it in the correct way by storing it in tgamt only when orders are placed. But that didn't work until I gave it another IF statement, which was essentially the same IF statement used to test entry conditions.
I think the BEGIN/END was the issue.
Then my next question stems from the BEGIN/END that you added. I looked those up, and I understand what they do, however, why did you remove the stoploss from them and move to a different condition?