- ago
I am working on a custom BuildingBlock which should work similar to the "Transaction Weight" block.

It is going to be a ConditionBlock. It should generate some code after the PlaceTrade() statement as "Transaction Weight" does:

CODE:
_transaction = PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, 0, "..."); _transaction.Weight = weight[index] * -1;
I can't find any explanation how this can be accomplished in the API documentation
(https://www.wealth-lab.com/Support/ExtensionApi/BuildingBlock)

Any hints?
0
144
Solved
1 Replies

Reply

Bookmark

Sort
Cone8
 ( 25.44% )
- ago
#1
All Buy and Short signals return a Transaction to a local _transaction variable, so Transaction properties can be assigned in the GenerateTransactionCode virtual method. Here's the code for Weight -

CODE:
//transaction specific code public override void GenerateTransactionCode() { string mult = Parameters[1].AsString == "Lowest Values" ? "-1" : "1"; ParentEntryExit.MainCode.Add("_transaction.Weight = <weight>[index] * " + mult + ";"); }
1
Best Answer

Reply

Bookmark

Sort