Strategy 1:
Data1: AAPL
Code: Select all
code to go long AAPL
Data1: SPY
--- Data2: AAPL
Code: Select all
if marketposition_at_broker of Data2 > 0 then
sell short next bar at market;
Code: Select all
code to go long AAPL
Code: Select all
if marketposition_at_broker of Data2 > 0 then
sell short next bar at market;
I thought those only worked with indicators, right? I'm trying to communicate between two signal-based strategies. Let's say I wanted to automatically hedge a new position. On the most basic level, it would be something like:Go to the Wiki
8 PowerLanguage Keyword Reference
Look under Plotting (14 P)
I_getplotvalue
I_setplotvalue
Code: Select all
if currentime_s > 000008 then
buy next bar at market;
Code: Select all
if marketposition_at_broker of data2 > 1 then
sell short next bar at market;
Code: Select all
print(MarketPosition_at_Broker of data1);
Code: Select all
[IntrabarOrderGeneration = True]
if currenttime_s > 080000 and marketposition = 0 then
buy next bar at market;
pmm_set_global_named_num("mpx", 1);
Code: Select all
if pmm_get_global_named_num("mpx") > 0 then
sell short num_share shares next bar at market;