NexusFi: Find Your Edge


Home Menu

 





Stop Loss last bar Low/High coding issues


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,551 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
FutureTrader112
Amsterdam Netherlands
 
Posts: 52 since Aug 2020
Thanks Given: 13
Thanks Received: 22

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.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
ATFX Suspends Prop Trading Unit ATFunded -- Full Review …
Funded Trading Evaluation Firms
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #2 (permalink)
tyler803
columbia, sc
 
Posts: 3 since Nov 2022
Thanks Given: 0
Thanks Received: 5


FutureTrader112 View Post
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.

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


Reply With Quote
Thanked by:




Last Updated on February 19, 2023


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts