Re-short after making a new high of day - futures io
futures io



Re-short after making a new high of day


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Re-short after making a new high of day

(login for full post details)
  #1 (permalink)
thinkorn00b
stavanger
 
 
Posts: 12 since Sep 2020
Thanks: 1 given, 1 received

Hi

So I have this code that sell short when two conditions are met:

 
Code
Variables: 
SynOpen( 0 ),    
SynClose( 0 ), 
 
 
SynOpen  = (SynOpen[1]+SynClose[1])*.5;    
SynClose = (Open+High+Low+Close)*.25; 
 
Condition1 = (High[0] = HighD(0)) 
If Condition1 then begin  
Ashisignal = true; 
end; 
 
Condition2 = (SynClose <= SynOpen)
This short the stock at market price at the next red candle.

I want to re-short (if I take a win) when the price goes above the "high of the day follow by a red candle" (condition 1 and 2).
With the same criteria as in condition 1 and 2.
What the code does now is to re-short again after the first red candle without the stock making a new high of day.


Reply With Quote

Can you help answer these questions
from other members on futures io?
Big Mo Indicator for NT8
NinjaTrader
Market on Close data within IB
Platforms and Indicators
in depth understanding of last, bid, and ask volume in c …
NinjaTrader
Demo accounts order fill
Emini and Emicro Index
Tradovate + Jigsaw issues
Tradovate
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
52 thanks
An embarrassing, honest confession
37 thanks
Sierra vs. Ninja : why I chose .....
8 thanks
Machine Learning Journal
5 thanks
Institutional Grade Massive Data Dump for Quant Research …
5 thanks
 
(login for full post details)
  #2 (permalink)
arni
Hamburg, Germany
 
 
Posts: 5 since Dec 2021
Thanks: 1 given, 2 received

You could probably have a new variable that always saves the high of the current candle if it is higher than the high of the previous one. You could then build a condition around that for your entries. For example, lets say your candle N is a bear candle and the high of candle N-1 equals your variable, then you have an entry signal.

Reply With Quote
 
(login for full post details)
  #3 (permalink)
thinkorn00b
stavanger
 
 
Posts: 12 since Sep 2020
Thanks: 1 given, 1 received



arni View Post
You could probably have a new variable that always saves the high of the current candle if it is higher than the high of the previous one. You could then build a condition around that for your entries. For example, lets say your candle N is a bear candle and the high of candle N-1 equals your variable, then you have an entry signal.

Thank you, however my problem with that way to write the code is that once the position is covered, and the price has not gone over HOD again, the condition is still valid, so it will re-short below HOD. It should only short once below HOD. For a second short the stock needs to break HOD again.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
arni
Hamburg, Germany
 
 
Posts: 5 since Dec 2021
Thanks: 1 given, 2 received


thinkorn00b View Post
Thank you, however my problem with that way to write the code is that once the position is covered, and the price has not gone over HOD again, the condition is still valid, so it will re-short below HOD. It should only short once below HOD. For a second short the stock needs to break HOD again.

Well, I see I have phrased my idea incorrectly. You would probably want to set an initial high to a variable and only if any successing candle has a high that is higher than that variables value, save the new high to the variable.

So maybe declare a variable "HOD" and set it to the high of the opening candle. Then, if any successing high is higher than the current value saved to your variable "HOD", set the variable to that new highs value. So basically do not compare candle N to candle N-1 like I said in my first post, but instead, compare the high of candle N to the value of "HOD" variable. Hope this makes more sense.

That way, it should only consider a new high of day where there is an orange arror in the picture below.

Reply With Quote
 
(login for full post details)
  #5 (permalink)
thinkorn00b
stavanger
 
 
Posts: 12 since Sep 2020
Thanks: 1 given, 1 received


arni View Post
Well, I see I have phrased my idea incorrectly. You would probably want to set an initial high to a variable and only if any successing candle has a high that is higher than that variables value, save the new high to the variable.

So maybe declare a variable "HOD" and set it to the high of the opening candle. Then, if any successing high is higher than the current value saved to your variable "HOD", set the variable to that new highs value. So basically do not compare candle N to candle N-1 like I said in my first post, but instead, compare the high of candle N to the value of "HOD" variable. Hope this makes more sense.

That way, it should only consider a new high of day where there is an orange arror in the picture below.

Hi, well this is the part of the code I'm struggeling with, how to save the high of the high of the day, and make the code code execute again if a value is above that high. Also for the first short, it needs to execute without even though there hasn't been a high that is saved, as its the first high of the day. The code needs to reset each day.
The way I define the high of the day, is as seen in the code is when the red candle follow the green candle (which is the HOD).

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Re-short after making a new high of day


Last Updated on October 23, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts