NexusFi: Find Your Edge


Home Menu

 





Programming third profitable close


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
edgeseek
Riyadh, Saudi Arabia
 
Posts: 5 since Feb 2017
Thanks Given: 0
Thanks Received: 0

Hey all,

I'm trying to program a strategy to exit on the third profitable close.

But I have had success only to program it to exit on one profitable close only.

Would appreciate the help if any..
 
Code
If marketposition = 1 and  close > entryprice Then
	Sell 1 contract this bar close;


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
GDP Day: The First Economic Reckoning -- Pahlavi at 6.55 …
Prediction Markets & Event Contracts
Day 97: Israel-Lebanon Ceasefire Struck Overnight -- WTI …
Traders Hideout
CME Cuts Precious Metals Margins Up to 21% Starting Toda …
Commodities
SEC and CFTC Unlock Customer Cross-Margining for Treasur …
Treasury Notes and Bonds
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639


edgeseek,

how exactly do you define the "third profitable close", can you provide an example?

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #4 (permalink)
edgeseek
Riyadh, Saudi Arabia
 
Posts: 5 since Feb 2017
Thanks Given: 0
Thanks Received: 0

I would define it as third close larger than entry price:

Close > Entry price .....first profitable close ( do nothing)

Close > Entry Price .... second profitable close ( do nothing)

Close > Entry Price ..... third profitable close (Take as third profitable close)

I hope this explains it clearly


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

edgeseek,

do you mean three bars have to Close above the entry price while you are in a trade?
If that is the case you have to program your own counter. Use a variable and add +1 to it when your condition is met.
Then when the counter variable is >= 3 trigger your exit.

Finally you only have to reset it after the trade, at the beginning of a new trade or when the Close is below your entry price - depending on what you have in mind of course.

Regards,

ABCTG


Follow me on X Reply With Quote
  #6 (permalink)
edgeseek
Riyadh, Saudi Arabia
 
Posts: 5 since Feb 2017
Thanks Given: 0
Thanks Received: 0

That is exactly what I was thinking. If you can please explain how to setup the variable and the counter variable I have googled a lot and couldn't find anything specific related to this.


Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

edgeseek,

I would suggest to take a look at the EL Essentials PDF, this will cover a lot of the required basics.

Post the code you did so far based on the possible solution I wrote and I will gladly look it and steer you in the right direction.

Regards,

ABCTG


Follow me on X Reply With Quote




Last Updated on February 20, 2017


© 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