store data based on event and use for future calculation
Forums › ProRealTime English forum › ProBuilder support › store data based on event and use for future calculation
- This topic has 9 replies, 2 voices, and was last updated 4 years ago by theo123.
Tagged: s
-
-
12/15/2020 at 7:53 AM #153788
Hi,
Im wondering if data (eg. Donchian Channel Down) in a given event (price > donchian channel middle) can be collected everytime the event happened and used it in the future calculation.
Say, there are 4x an event happen in a given timeframe. Note: counter or data collection, will reset if price crosses under donchianMiddle
12EventTrigger = price crosses over dochianMiddleDCDatEVENT = DonchianDownI intend to have 2 calcuations:
Calcuation will be for maximum: 2nd time event happen, get the max of DCDatEVENT (first and second); 3rd time (max of the last 3), 4th time (max of all 4). What is the code for this?
Use the latest DCDatEvent as stop loss
appreciate any response.
12/15/2020 at 11:55 AM #153828Note: counter or data collection, will reset if price crosses under donchianMiddle
Ok, but in order for the price to cross over the Middle line, it needs first to cross under, so how do you want to store multiple price levels if you reset everything before any consecutive event?
12/15/2020 at 12:11 PM #15383212/15/2020 at 12:34 PM #153835price > donchian channel middle
is different from
price crosses over donchian channel middle
please define what is the condition to use the DonchianChannelDown as a stoploss.
By the way, it will never trigger as you “early exit” when you cross the middle line!
12/15/2020 at 1:39 PM #153840yes, they are differentand those are the scenarios that im lookimg for ie. 4 times the PRICE<MIDDLE, then later after candles or right after PRICE CROSSES OVER MIDDLE without crossing the donchiandown.
so in addition to above, buy and sell codes will be like this.
12345678if not longonmarket and EventTrigger thenbuy 1 at matketset stop loss at DCDatEVENTend ifif longonmarket and price crosses under DonchianMiddle thensell at marketendifthe one I would like to add in the sell code are the either of the 2 options stated in the initial post based on succeeding DCDatEvent during possible 2 or more events of price crosses over donchianmiddle
-as per the initial post, it should either the maximum of all previous DCDatEvent or the latest DCDatEvent.
12/15/2020 at 3:13 PM #153856But there are cases that I see that there are no crosses under that happens but price opens lower than the middle and crosses over.
If the price was above and now below, it is a crossover.
Well, at this point, I think a picture would be way better to explain what you want, cause I’m lost now…
12/15/2020 at 6:22 PM #15386112/15/2020 at 6:24 PM #15386312/16/2020 at 6:32 PM #15403912/17/2020 at 2:45 PM #154134Found a psoosible solution but not working fully as intended. create an indicator first to know how ot would look like.
note, this is for target2: use the latest donchianmiddle during triggerevent
123456789101112131415DonchianDown=LOWEST[10](LOW[1])DonchianUp=highest[10](high[1])donchianMiddle =(DonchianDown+DonchianUp)/2EventTrigger = close crosses over donchianMiddleDCDatEVENT = DonchianDownif EventTrigger thenexitLIne=DCDatEVENTmybarindex=BARINDEXENDIFif NOT EventTrigger thenexitLIne=DCDatEVENT[mybarindex]endifreturn exitlineappreciate who could advice tge changes required to the code. i dont know why it goes up after 10bars
-
AuthorPosts
Find exclusive trading pro-tools on