I am reasonably new to AB but learning at a great rate of knots. I'd like to create some code as follows and would appreciate any advice:
After a Buy signal (already coded) set an initial stop at (say) 10% from the prior period close.
As prices rise, have the trailing stop follow up, trailing 10% from the highest close recorded since the Buy (a bit like a chandelier stop) i.e. the stop is never lowered.
Here is a link to the knowledge base with an example that explains one applystop and one loop version AmiBroker Knowledge Base » How to plot a trailing stop in the Price chart both executing the same thing. You could alter that loop version to apply any other stop/target method or could write your own loop from scratch or just use Applystop function with built-in methods. If Applystop doesn't have your preferred method in place then as mentioned with a selfmade loop version you can create that one or any other one yourself.
Here is an example from the AB users forum trail stop+initial stop which seems to be similar to what you are looking for.
The following user says Thank You to occasionallurker for this post:
Thanks occasionallurker. Can you please advise how I can get a copiable version of the code you referred to in "Here is an example from the AB users forum trail stop+initial stop which seems to be similar to what you are looking for." as the link is an image file
Do you mean to say that both of your hands are too tired or too much broken or even too much non-existent in order to be able to transcribe just a few lines of code from a picture? What about the guy(s) who had to think and to write at the same time? Would you agree that doing just a little bit of handwork without thinking looks like a fair deal or would you agree that this world is becoming a sadder place with every new day?
You know what, that is exactly what I did in the end. Your impertinence and sarcasm is astounding to say the least. I agree the world is not what it used to be, particularly regarding manners and civility. Perhaps you had a bad day and if so I'm sorry for you, your wife or dog whichever you normally bully. Sometimes it's better to not respond and in this case it would have been better. In the meantime I sincerely wish you well in your trading.
That's interesting that posting two links and pointing out the truth about obvious laziness is equal to being impertinent nowadays. Please give me a moment to get the complete logic. I'm sorry in advance if it may take a few hundreds of years to understand even 1% of it since in my world the meaning of impertinence could rather be described by the words "Give them a finger, and they'll take the whole hand". But perhaps I haven't been realizing yet that I have been frozen for a few hundreds of years and the meaning has changed dramatically since back then. Then I'm very sorry for not being up-to-date. My bad. I'm gonna download and installl the most recent stupidity update from MS servers and reboot my brain.
In your response you demonstrate the same attitude "it's not me!". Go ahead and live in your ignorance but don't drag the world in to it. Quite frankly I find this, not you, boring. I will move on making good profits from good expectancy and leave you to it. As I said before I wish you well. Goodbye lurker.
The user occasionallurker has been banned for rude behavior. We have no tolerance for that here.
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.
The following user says Thank You to Big Mike for this post:
A good outcome, thank you. I was just about to unsubscribe from the site because of this but am refreshed by the your decision. Life is too short so let's get on being positive. Good fortune to all who participate herein.