NexusFi: Find Your Edge


Home Menu

 





[Condition] IF B happen within a timeframe after A happen, then C


Discussion in MultiCharts

Updated
    1. trending_up 852 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

[Condition] IF B happen within a timeframe after A happen, then C

  #1 (permalink)
FDZL
Hong Kong
 
Posts: 6 since Feb 2019
Thanks Given: 1
Thanks Received: 1

Hi all,

If I want to code this :

IF B happen within a timeframe after A happen, then C

How can I code this into powerlanguage please?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
About a successful futures trader who didnt know anythin …
Psychology and Money Management
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Hi FDZL,

can you show an example to clarify what you mean by "within a timeframe"?

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #3 (permalink)
FDZL
Hong Kong
 
Posts: 6 since Feb 2019
Thanks Given: 1
Thanks Received: 1



ABCTG View Post
Hi FDZL,

can you show an example to clarify what you mean by "within a timeframe"?

Regards,

ABCTG

Hi ABCTG,

Thanks for replying.

For example, if B happen with 1 minute after A = true (and therefore can not use If..and...then statement) , then C;

Is it possible to code this?

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

Hi FDZL,

the approach will depend a bit on the timeframe you are working on. If you are working on one minute bars you could store the value of the reserved CurrentBar in a variable when your code detects condition A.
Then you can compare the current value of CurrentBar against the stored value when you evaluate your condition B.

Regards,

ABCTG


FDZL View Post
Hi ABCTG,

Thanks for replying.

For example, if B happen with 1 minute after A = true (and therefore can not use If..and...then statement) , then C;

Is it possible to code this?


Follow me on Twitter Reply With Quote
  #5 (permalink)
FDZL
Hong Kong
 
Posts: 6 since Feb 2019
Thanks Given: 1
Thanks Received: 1


ABCTG View Post
Hi FDZL,

the approach will depend a bit on the timeframe you are working on. If you are working on one minute bars you could store the value of the reserved CurrentBar in a variable when your code detects condition A.
Then you can compare the current value of CurrentBar against the stored value when you evaluate your condition B.

Regards,

ABCTG

Dear ABCTG,

But my case is that condition A is a exit action ( Sell / buy to cover ) and I am not too sure if this can be code into condition....

IE " sell all contract next bar at market " cannot really be coded into condition in multi chart as far as I'm concerned.

Is there any way around this ? Much appreciated for your assistance.

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

FDZL,

do you use any condition to decide when to trigger the exit? If so, use that, too. If not, you could for example monitor the change in the market position (to now being flat) or detect a particular exit name etc.. to set the value of the variable.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #7 (permalink)
FDZL
Hong Kong
 
Posts: 6 since Feb 2019
Thanks Given: 1
Thanks Received: 1


ABCTG View Post
FDZL,

do you use any condition to decide when to trigger the exit? If so, use that, too. If not, you could for example monitor the change in the market position (to now being flat) or detect a particular exit name etc.. to set the value of the variable.

Regards,

ABCTG

My problem is solved with your set value of the variable advise!

Thank you so much for your kind assistance!

Reply With Quote
Thanked by:
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

FDZL,

you are welcome and thank you for your feedback.

Regards,

ABCTG


FDZL View Post
My problem is solved with your set value of the variable advise!

Thank you so much for your kind assistance!


Follow me on Twitter Reply With Quote




Last Updated on June 6, 2019


© 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