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)
Need help with a stop loss based off a moving average value
I think I mentioned it a long time ago, that's why I'm so familiar with where you're located. I will be up there this summer (Westlake), so I will reach out to you privately in case we have a chance to meetup.
I have this working most of the time. One thing I am having trouble with is keeping the stop loss value static or predictable. I'm using the difference from the entry price and the medium length moving average of the pivot bar. The thing that makes everything wonky is if there's another pivot discovered before the stop get's triggered. I don't know how to go about that.
This is what I have currently and I know it's throwing it off since the Pivot function is set to the most recent occurance:
I can't figure out how to take the MA of the trigger pivot and ONLY the trigger pivot. I'm dropping in a picture of it happening. The vertical blue is the pivot that is being identified, the horizontal line is where the exit should be based on the moving average value. As you can see it exits well above.
pivot exit
Side question: can you have conditions for SetStopPositions? I thought I read somewhere that Easy Language takes the LAST conditional and uses that regardless if there is more. Is there a way to get around that?
For the pivot/average stop, to set it at the trigger point, capture the value right when you buy (I did not test this, this is just in general how you could do it):
For the side question, you could have conditionals;
With your help, I've got everything working except, I think I am coming to realization that you can not have two SetStopLoss/SetProfitTargets in one strategy. I was hoping to use the medium moving average value at pivot low to be my stop loss if the buy happened above the medium moving average, and then use a slow moving average value at pivot low to be the stop loss if the buy occurred below the medium moving average. Seems like the last SetPosition group ends up being the dominate one. Even if I split the code in two separate strategies on the same chart. Say it ain't so!
I have two different versions of the below as my stoploss/profit targets based on which entry condition occurred.
This works on it's own, but not when there are two. Any advice?
I would convert to a regular stop/limit statement (will not work on the bar of entry though):
Sell next bar at XXXX stop;
Sell next bar at YYYY limit;
but note XXXX and YYYY are prices, not dollar values like you use in SetStopLoss. So you have to convert MedStop from dollars to actual price value...
@kevinkdog, is this how you send both a stop and limit order at the same time? I could never figure that out in EasyLanguage (MC PowerLanguage allows one statement for both).
@kevinkdog, is this how you send both a stop and limit order at the same time? I could never figure that out in EasyLanguage (MC PowerLanguage allows one statement for both).
I believe if you try to send both, only one will be "active" at any one time.