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)
I wasn’t able to find a relevant thread and hope someone can help me to improve my code.
I'm having trouble coding a basic Stop Loss strategy. The idea should be as follows:
1) Buy/Sell a contract in the NASDAQ 100 based on the actual strategy.
2) Set the Stop Loss to the previous bar's low/high before the trade entry bar. For example, if a trade opens at 12pm, the stop loss should be based on the 11pm bar (1H chart).
The SL moves with the trade, which causes problems. If the trade is still open after 1 hour and another bar is created, the SL moves to the next low/high bar. It should remain fixed.
Is it possible to use the Set StopLoss strategy, where the difference between the open price and the previous day's Low/High is calculated?
SetStopLoss (Entry – Low previous bar)
Is there a better way to set the stop loss? That is based on the total position, so if I trade more than one contract, I must modify the calculation by multiplying it by the contract.
Can you help answer these questions from other members on NexusFi?
I'm not sure what language you are coding in and my only experience is using the ninjatrarer strategy builder. I would make a variable parameter and have it set when you enter position. The variable value would be the price at which you want to set the stop. Then you would tell it to exit the position if price goes above/below that set value and it won't follow the low/high of every bar after that