More Question (position based management, turns, and triggers)

Couple more questions for a newbie to Seetu:

I couldn’t find functions/methods for this in the manual - if it exists, just point me to it.

  • Position Based Management:

  • How to sell a position after x bars, days, etc…

  • How to sell a position after a profit is reached (% or $)

  • How do I plot executed trades on the chart?

  • Are there TurnUp/TurnDown functions? (maybe I thinking about this wrong - so let me know if this is the case)

  • Do you have plans for triggers? This something really cool that I haven’t seen implemented with so I’ve made my crude version of it in wealth-lab. If you guys could implement this, it would leap-frog your platform by make complex logic very manageable. (Let me know if your interested in knowing the details and how it works in other industries)

I’m excited for a hosted platform that can run unattended and without hand-holding like I currently have to do with wealth-lab.

After reviewing the forums, I found stop loss example that could possible help with selling at a profit. But still, I would need to know entry price to do this right ???

Trading prices are in BuyPrice, SellPrice, ShortPrice and CoverPrice

You can find BUY signals entry prices this way:
YourLongEntryPrice = ValueWhen(Buy,BuyPrice);

Sell after 5 bars:

Buy = Cross(CalcMACD(), CalcMACDSignal());

Sell = BarsSince(Buy) >= 5;

Sell = trimExcess(Sell,Buy);

Buy = Cross(CalcMACD(), CalcMACDSignal());
Sell = BarsSince(Buy) >= 5;
Sell = trimExcess(Sell,Buy);

DoPlot(Buy,"Buy",colorGreen,style=styleHistogram);
DoPlot(Sell,"Sell",colorRed,style=styleHistogram);

Can you be more specific? Averaging positions?

Can you be more specific? What do you mean by “triggers”?

What I think I’m learning is that seetu is intended to operate at higher level that I’m used to. This is mental shift on my part so thanks for helping out!!

TurnUp/Down are when indicators changes change an opposing direction. For example, a moving average is moving down, then turns up, this would be the TurnUp().

Buy = TurnUp(CalcMA(Close, 50));    // Buy when the 50 bar moving average turns up

Buy = TurnDown(CalcMA(Close, 50));  // Sell when the 50 bar moving average turns down

Sometimes we would like to see momentum in the turn so implementing a hysteresis check would be great.

Buy = TurnUp(CalcMA(Close, 5), 3);  // Buys when the 5 bar moving average turns up and stays up for 3 consecutive bars.

I’m guessing there is way to do this and again, I’m not thinking the “Seetu way” quite yet.


Triggers are a clean and declarative way to implement complex logic and also great for evaluation.

Let me come up with a good example for this. Can you email me at my registered email to discuss this further?

If I undestand well: TurnUp means for example a sequence of values 10 , 5 , 10
(Values go down and up then.)

I developed this. Hopefully it is what you mean.

SetOption("Symbols","MSFT,FB");

maCurrent = CalcMA(Close, 30); // I need MA(30) for MSFT nad FB to generate signals.
maPrev = Ref(maCurrent,-1); // Turning point
maPrevPrev = Ref(maCurrent,-2);

// This the formula:
// Buy = maPrevPrev > maPrev and maPrev < maCurrent; 
// But it needs some cleaning. 
// MA differences can be too small. For example just 0.00001. So try 0.02 differences.

Buy = maPrevPrev - 0.02 > maPrev and maPrev < maCurrent - 0.02; 

Filter = Buy;
AppendColumn(maPrevPrev,"maPrevPrev");
AppendColumn(maPrev,"maPrev(Turn)");
AppendColumn(maCurrent,"maCurrent");

DoPlot(Close,"Close",colorBlack);
DoPlot(maCurrent,"MA",colorBlue);
DoPlot( maPrev * Ref(Buy,1), "Turn",colorRed,style=styleHistogram);
DoPlot(Buy*maCurrent,"Buy",colorGreen,style=styleHistogram);

Re: “stays up for 3 consecutive bars” - I am not sure yet.

Hello!

This is a possible solution:

SetOption("Symbols","MSFT,FB");

// Bars shifts from the current bar to the history
beforeTurningPoint = -6;
turningPoint = -5;
afterTurningPoint = -4;
afterTurning_day1 = -3;
afterTurning_day2 = -2;
afterTurning_day3 = -1;

// Prepare a moving average (30 bars for this example)
ma = CalcMA(Close, 30); 

// Valuesfor the formula:
maBT = Ref(ma,beforeTurningPoint); // before turning point
maT = Ref(ma,turningPoint); // turning point
maAT = Ref(ma,afterTurningPoint); // after turning point
maD1 = Ref(ma,afterTurning_day1); // day #1 after turn-up
maD2 = Ref(ma,afterTurning_day2); // day #2 after turn-up
maD3 = Ref(ma,afterTurning_day3); // day #3 after turn-up

// This is the formula:
 Buy = maBT > maT and maT < maAT // TurnUp
       and maD1 > maT 
       and maD2 > maT 
       and maD3 > maT;

// Check a data in Exploration
Filter = Buy;
AppendColumn(maBT,"Before TP");
AppendColumn(maT,"TP");
AppendColumn(maAT,"After TP");
AppendColumn(maD1,"Day1");
AppendColumn(maD2,"Day2");
AppendColumn(maD3,"Day3");

// Visualization
DoPlot(Close,"Close",colorBlack);
DoPlot(ma,"MA",colorBlue);
DoPlot(Buy*ma,"Buy",colorGreen,style=styleHistogram);