NexusFi: Find Your Edge


Home Menu

 





Retrace before reentry?


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one jrh059 with 6 posts (0 thanks)
    2. looks_two SMCJB with 4 posts (2 thanks)
    3. looks_3 ABCTG with 4 posts (3 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 5,316 views
    2. thumb_up 5 thanks given
    3. group 3 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
jrh059
Denver CO
 
Posts: 6 since Jul 2014
Thanks Given: 3
Thanks Received: 0

I've been stuck on this problem for awhile and wondering if there is a simple solution.

I am using SetStopLoss to exit a position (say 20 ticks) but only want to re-enter a position if price has gone against the original entry price by at least 40 ticks at some point between my SetStopLoss exit and the next entry.

any suggestions?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Strike Pause Holds, Oil Erases Monday Spike -- May CPI W …
Traders Hideout
Al Arabiya: US-Iran Draft Deal Within Hours Contains Hor …
Prediction Markets & Event Contracts
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
Hormuz Surges From 14% to 26.5% Intraday as Irans Answer …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


jrh059,

we could try to point you in the right direction when you post the code you are stuck with.
One idea would be using a flag that you use to only allow another entry in case the market moved X points higher than your exit price.

Regards,

ABCTG


Follow me on X Reply With Quote
  #4 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT Stellar & Tradestation
Broker: Primarily Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals, U308 and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,242 since Dec 2013
Thanks Given: 4,586
Thanks Received: 10,533

Maybe a noob question @ABCTG but how do you know what your exit price was?


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

@SMCJB,

you can access the exit price via the reserved word ExitPrice. This will work fine, unless you scale in and out of positions. In this case you can access the respective prices using the StrategyHost class.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

The same way the entry price is accessible via the reserved word EntryPrice. @jrh059 you can use this to only allow a new entry when you are flat and if the current price is X ticks above the last entry price.

Regards,

ABCTG


Follow me on X Reply With Quote
  #7 (permalink)
jrh059
Denver CO
 
Posts: 6 since Jul 2014
Thanks Given: 3
Thanks Received: 0

Thank you for your response.

To clear up any confusion, once I am stopped out of a long position, I want price to go LOWER than where I was stopped out before taking another entry.

The code I am currently trying is as follows:

Var:
bool LongFalseStop(False);

If ExitPrice(1)<=EntryPrice(1)-.20 and Lowest(Low,BarsSinceExit(1))<=EntryPrice(1)-.40 then
LongFalseStop=True;

If LongFalseStop=True then Buy

Using the print function, I can tell that this should work but the problem is that I can't figure out how to initiate the first entry without setting the LongFalseStop Variable to TRUE in the beginning, at which point the code doesnt work.


Reply With Quote
  #8 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT Stellar & Tradestation
Broker: Primarily Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals, U308 and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,242 since Dec 2013
Thanks Given: 4,586
Thanks Received: 10,533

entryprice is zero until you have your first trade

 
Code
Var:
   bool LongFalseStop(False);

if entryprice = 0 then
   first trade condition
else begin
   If ExitPrice(1)<=EntryPrice(1)-.20 and Lowest(Low,BarsSinceExit(1))<=EntryPrice(1)-.40 then LongFalseStop=True;
   If LongFalseStop=True then Buy
end;


Reply With Quote
Thanked by:
  #9 (permalink)
jrh059
Denver CO
 
Posts: 6 since Jul 2014
Thanks Given: 3
Thanks Received: 0

Thank you! That did work. However, now it seems that the LongFalseStop stays True for every bar following the first bar that it is True, making it ineffective because there is never a False condition. Is there a way to make it reset or reevaluate each bar?


Reply With Quote
  #10 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT Stellar & Tradestation
Broker: Primarily Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals, U308 and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,242 since Dec 2013
Thanks Given: 4,586
Thanks Received: 10,533


Just set it to false on every bar or my preference is to

 
Code
If ( (ExitPrice(1) <= EntryPrice(1) - 0.20) and (Lowest(Low, BarsSinceExit(1)) <= EntryPrice(1) - 0.40) ) then
   LongFalseStop = True else LongFalseStop = False;


Reply With Quote




Last Updated on April 6, 2018


© 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