NexusFi: Find Your Edge


Home Menu

 





Referencing Data(2) Bar on the 1M chart


Discussion in Traders Hideout

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




 
Search this Thread

Referencing Data(2) Bar on the 1M chart

  #1 (permalink)
 fiverr 
Calgary
 
Experience: None
Platform: TradeStation, MT4
Trading: ES, Stocks
Posts: 73 since Aug 2015
Thanks Given: 4
Thanks Received: 11

Hi there,

I have the following codes that run on the 30M chart; however, I would like to attach my strategy to the 1M chart but still reference these codes to the 30M chart. Your inputs are greatly appreciated.

 
Code
if TIME >= FinalExit then
Begin
   if MarketPosition =-1 then BUYTOCOVER ("Buy to Exit") NumberOfContracts CONTRACT NEXT BAR Market;
   if MarketPosition = 1 then SELL ("Sell to Exit") NumberOfContracts CONTRACT NEXT BAR MARKET ;
End ;


if TIME > EndTime OR TIME < StartTime then
Begin
   BUYTOCOVER NumberOfContracts CONTRACT THIS BAR CLOSE ;
   SELL NumberOfContracts CONTRACT THIS BAR CLOSE ;
End ;

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


fiverr,

can you elaborate a bit more what you mean with "still reference these codes to the 30M chart"?
Trades can only be executed on Data1 (at least with legacy EasyLanguage). In case you are looking to execute trades based of Data2 data you can use variables that you evaluate on Data2 (something like setting a boolean to true when the condition is present) and then place trades on Data1 when this variable has the correct state.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
 fiverr 
Calgary
 
Experience: None
Platform: TradeStation, MT4
Trading: ES, Stocks
Posts: 73 since Aug 2015
Thanks Given: 4
Thanks Received: 11


ABCTG View Post
fiverr,

can you elaborate a bit more what you mean with "still reference these codes to the 30M chart"?
Trades can only be executed on Data1 (at least with legacy EasyLanguage). In case you are looking to execute trades based of Data2 data you can use variables that you evaluate on Data2 (something like setting a boolean to true when the condition is present) and then place trades on Data1 when this variable has the correct state.

Regards,

ABCTG

ABCTG,

I believe that I found the solution. Please let me know your thoughts.

 
Code
time_2 =    TIME of data(2);
if time_2 >= FinalExit then
Begin
   if MarketPosition =-1 then BUYTOCOVER ("Buy to Exit") NumberOfContracts CONTRACT NEXT BAR Market;
   if MarketPosition = 1 then SELL ("Sell to Exit") NumberOfContracts CONTRACT NEXT BAR MARKET ;
End ;
The reason why I wanted to write my code on the 1M chart and reference the logic on 15M or 30M so that I can identify the exact minute where I entered or exited the trade. Before this, the backtesting is not very informative since I can not compare the live results with the backtesting results to the actual minute by minute.

Started this thread Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

fiverr,

while your code works, I am not sure that you accomplish what you have in mind. But this is something you can probably tell best yourself when you see the backtest.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #6 (permalink)
 fiverr 
Calgary
 
Experience: None
Platform: TradeStation, MT4
Trading: ES, Stocks
Posts: 73 since Aug 2015
Thanks Given: 4
Thanks Received: 11


ABCTG View Post
fiverr,

while your code works, I am not sure that you accomplish what you have in mind. But this is something you can probably tell best yourself when you see the backtest.

Regards,

ABCTG

ABC,

Here is what I am trying to accomplish so let me know your thoughts. See below backtesting results in MC.



As you can see, the original code is referencing 30M, and I am using 1M bar magnifier to obtain the backtesting results. When I look at my backtesting results (list of trades), the resolution step is 30 minutes. So I don't know whether the trade entered at 9:01AM or 9:28AM.

When I use 1M code to reference 30M logics, I obtain a 1-minute resolution. See below.



As you can see above, I know exactly that the trade entered at 9:03M and exited at 9:13AM.

Please let me know if this makes sense or that I am trying to reinvent the wheel.

Started this thread Reply With Quote




Last Updated on May 5, 2016


© 2024 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 - Privacy Policy - Downloads - Top
no new posts