| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | EL: Get High of a Bar from a Specific Time Yesterday I'm trying to figure out 2 things: 1. How can I get the high of a bar at a specific time 2. How can I run a piece of logic at a specific time? For example: At 10:30am, I'd like to get the high of the 3:30 bar yesterday to compare, and place a buy order based on the results. Makes no sense, but just trying to understand how to work with bar times. | ||
| |
|
| | #2 | ||
![]() | Re: EL: Get High of a Bar from a Specific Time Yesterday Code: variables yesterdaysHigh(0); // if time is 10am if Time = 1530 then yesterdaysHigh = High; if Time = 1000 then // do something with yesterdaysHigh | ||
| |
|
| The Following User Says Thank You to TraderFoo For This Useful Post: | ||
Tams (07-06-2009) | ||
| | #3 | ||
![]() | Re: EL: Get High of a Bar from a Specific Time Yesterday I mean something like this: if time > 10:00 and time < 15:00 then the highest high for that period is 'HH'. | ||
| |
|
| | #4 | ||
![]() | Re: EL: Get High of a Bar from a Specific Time Yesterday //create variables //store the 'bar count' in the variable using 'currentbar' keyword Quote:
| ||
| |
|
| | #5 | ||
![]() | Re: EL: Get High of a Bar from a Specific Time Yesterday I've changed the code according to your advice. Here is what happened: vars: startbar(0), endbar(0), length(0); if time=1030 then startbar=currentbar; if time<=1039 then endbar=currentbar; length=endbar-startbar; if time>1039 and time<=1100 then Buy next bar at highest(h,length) stop; if marketposition=1 and time=1200 then sell next bar at market; If I followed your words correctly, it doesn't work as intended. There are trades between 1040 and 1100 but they are executed not at the high of the price range between 1030 and 1039. (I couldn't even figure out how 'get in' price is calculated). Could you, please, check my code again? | ||
| |
|
| | #6 | ||
![]() | Re: EL: Get High of a Bar from a Specific Time Yesterday I can't be sure what it is you want to do but I can give you some idea how EL reads bars. study this and see if you can convert it to what you want. If not, give it an honest attempt and I will try again. you have to think about the word 'length' here. length was moving target in your last code because endbar was equal to current bar. so I changed it to 'lock' the variable 'length' to a specific time. see if you can see the adjustment I made --- by using the variable 'value1' -- I am able to lock-in the highest price that was set during the specific time period you chose. Quote:
| ||
| |
|
| | #7 | ||
![]() | Re: EL: Get High of a Bar from a Specific Time Yesterday The code you wrote works fine but how can I avoid repeated trades when I add stoplosses and they are executed? | ||
| |
|
| | #8 | ||
![]() | Re: EL: Get High of a Bar from a Specific Time Yesterday and entriestoday(date)<3 Quote:
| ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I Want Alerts Based on Specific Parameters? | Johnson S. Mcdermott | Trading and the Markets | 5 | 06-08-2009 04:39 PM |
| Tried to Move OEC Specific Posts to This Area | brownsfan019 | Open E Cry | 0 | 02-03-2009 09:56 AM |
| Need to Rewrite Specific Macd from MQL or MultiChart for NT | backfoot | Automated Trading | 2 | 09-05-2008 01:24 PM |
| Who Caught This Yesterday? | james_gsx | The Candlestick Corner | 14 | 08-13-2008 11:50 PM |
| Be Specific: Precisely What Are You Doing Wrong? | MrPaul | Market Analysis | 4 | 11-14-2006 06:58 PM |