I ask for help with the script Power Language.

Questions about MultiCharts and user contributed studies.
AlexKendo
Posts: 20
Joined: 12 Sep 2012

I ask for help with the script Power Language.

Postby AlexKendo » 04 Jul 2022

Hello.
I'm just starting to use Power Language and I'm having trouble writing the script.
The task is the following. I want to use 1-hour timeframe bars. I want a position to be opened at the specified time of this bar (inside the bar) when the condition is fulfilled.
The problem is that with the code like in the example, I can see opening positions on the history of the chart, but the script does not open positions in real-time when running "Automate Order Execution".
Please help me fix my code so that the script works correctly in real-time.

SCRIPT CODE

Code: Select all

IntrabarOrderGeneration = true] //Intrabar trade available Inputs: StartTime(0630), //Start Time for Green Bar or Red Bar ControlTime(0635);// Control Time for Green Bar or Red Bar variables: IntraBarPersist GreenBar(False), IntraBarPersist myopen(0); //TRIGGER = If 06:30am (PST) Market open- -------------- //(06:30am Pacific Standard Time, New York session opens) If Time =StartTime then begin myopen=open; end; //Green Bar identification If ControlTime > StartTime then Begin If Time =ControlTime then begin GreenBar = close>myopen; end; //ENTRY = If after 06:30 am and Greenbar and Condiition1 then Buy market If Time>=ControlTime and Time[1]<=ControlTime and GreenBar then begin If marketposition=0 and CONDITION1 then Buy next bar at market; end;
Last edited by AlexKendo on 04 Jul 2022, edited 1 time in total.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: I ask for help with the script Power Language.

Postby TJ » 04 Jul 2022

See post #1 & #2
viewtopic.php?t=11713

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: I ask for help with the script Power Language.

Postby TJ » 05 Jul 2022

You can try CurrentTime.

Note: this keyword will work in realtime, but not in backtesting.


Return to “MultiCharts”